Hotlist Slow: Remove extra thread pool created by VolumeMountWatcherWin.
[chromium-blink-merge.git] / components / pairing / host_pairing_controller.h
blob7d79c4f5e0ded2869b1019642f8f95648ee7b93b
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_WAITING_FOR_CONTROLLER_AFTER_UPDATE,
22 STAGE_WAITING_FOR_CREDENTIALS,
23 STAGE_ENROLLING,
24 STAGE_ENROLLMENT_ERROR,
25 STAGE_ENROLLMENT_SUCCESS,
26 STAGE_FINISHED
29 enum UpdateStatus {
30 UPDATE_STATUS_UNKNOWN,
31 UPDATE_STATUS_UPDATING,
32 UPDATE_STATUS_REBOOTING,
33 UPDATE_STATUS_UPDATED,
36 enum EnrollmentStatus {
37 ENROLLMENT_STATUS_UNKNOWN,
38 ENROLLMENT_STATUS_ENROLLING,
39 ENROLLMENT_STATUS_FAILURE,
40 ENROLLMENT_STATUS_SUCCESS,
43 class Observer {
44 public:
45 Observer();
46 virtual ~Observer();
48 // Called when pairing has moved on from one stage to another.
49 virtual void PairingStageChanged(Stage new_stage) = 0;
51 // Called when the controller has sent a configuration to apply.
52 virtual void ConfigureHost(bool accepted_eula,
53 const std::string& lang,
54 const std::string& timezone,
55 bool send_reports,
56 const std::string& keyboard_layout) = 0;
58 // Called when the controller has provided an |auth_token| for enrollment.
59 virtual void EnrollHost(const std::string& auth_token) = 0;
61 private:
62 DISALLOW_COPY_AND_ASSIGN(Observer);
65 HostPairingController();
66 virtual ~HostPairingController();
68 // Returns current stage of pairing process.
69 virtual Stage GetCurrentStage() = 0;
71 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
72 virtual void StartPairing() = 0;
74 // Returns device name.
75 virtual std::string GetDeviceName() = 0;
77 // Returns 6-digit confirmation code. Can be called only on
78 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
79 virtual std::string GetConfirmationCode() = 0;
81 // Returns an enrollment domain name. Can be called on stage
82 // |STAGE_ENROLLMENT| and later.
83 virtual std::string GetEnrollmentDomain() = 0;
85 // Notify that the update status has changed.
86 virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0;
88 // Notify that enrollment status has changed.
89 // Can be called on stage |STAGE_WAITING_FOR_CREDENTIALS|.
90 virtual void OnEnrollmentStatusChanged(
91 EnrollmentStatus enrollment_status) = 0;
93 virtual void AddObserver(Observer* observer) = 0;
94 virtual void RemoveObserver(Observer* observer) = 0;
96 private:
97 DISALLOW_COPY_AND_ASSIGN(HostPairingController);
100 } // namespace pairing_chromeos
102 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_