Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / pairing / host_pairing_controller.h
blob207fef5b6b4a46e96ca06b1af43a2c385ff91194
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
6 #define COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_
8 #include <string>
10 #include "base/macros.h"
12 namespace pairing_chromeos {
14 class HostPairingController {
15 public:
16 enum Stage {
17 STAGE_NONE,
18 STAGE_INITIALIZATION_ERROR,
19 STAGE_WAITING_FOR_CONTROLLER,
20 STAGE_WAITING_FOR_CODE_CONFIRMATION,
21 STAGE_UPDATING,
22 STAGE_WAITING_FOR_CONTROLLER_AFTER_UPDATE,
23 STAGE_WAITING_FOR_CREDENTIALS,
24 STAGE_ENROLLING,
25 STAGE_ENROLLMENT_ERROR,
26 STAGE_PAIRING_DONE,
27 STAGE_FINISHED
30 enum UpdateStatus {
31 UPDATE_STATUS_UNKNOWN,
32 UPDATE_STATUS_UPDATING,
33 UPDATE_STATUS_REBOOTING,
34 UPDATE_STATUS_UPDATED,
37 class Observer {
38 public:
39 Observer();
40 virtual ~Observer();
42 // Called when pairing has moved on from one stage to another.
43 virtual void PairingStageChanged(Stage new_stage) = 0;
45 // Called when the controller has sent a configuration to apply.
46 virtual void ConfigureHost(bool accepted_eula,
47 const std::string& lang,
48 const std::string& timezone,
49 bool send_reports,
50 const std::string& keyboard_layout) = 0;
52 // Called when the controller has provided an |auth_token| for enrollment.
53 virtual void EnrollHost(const std::string& auth_token) = 0;
55 private:
56 DISALLOW_COPY_AND_ASSIGN(Observer);
59 HostPairingController();
60 virtual ~HostPairingController();
62 // Returns current stage of pairing process.
63 virtual Stage GetCurrentStage() = 0;
65 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
66 virtual void StartPairing() = 0;
68 // Returns device name.
69 virtual std::string GetDeviceName() = 0;
71 // Returns 6-digit confirmation code. Can be called only on
72 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
73 virtual std::string GetConfirmationCode() = 0;
75 // Returns an enrollment domain name. Can be called on stage
76 // |STAGE_ENROLLMENT| and later.
77 virtual std::string GetEnrollmentDomain() = 0;
79 // Notify that the update status has changed.
80 // Can be called on stage |STAGE_UPDATING|.
81 virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0;
83 virtual void AddObserver(Observer* observer) = 0;
84 virtual void RemoveObserver(Observer* observer) = 0;
86 private:
87 DISALLOW_COPY_AND_ASSIGN(HostPairingController);
90 } // namespace pairing_chromeos
92 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_