OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ | 5 #ifndef COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ |
6 #define COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ | 6 #define COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Config is a comma separated list of key-value pairs separated by colon. | 21 // Config is a comma separated list of key-value pairs separated by colon. |
22 // Supported options: | 22 // Supported options: |
23 // * async_duration - integer. Default: 3000. | 23 // * async_duration - integer. Default: 3000. |
24 // * start_after_update - {0,1}. Default: 0. | 24 // * start_after_update - {0,1}. Default: 0. |
25 // * fail_enrollment - {0,1}. Default: 0. | 25 // * fail_enrollment - {0,1}. Default: 0. |
26 // * code - 6 digits or empty string. Default: empty string. If strings is | 26 // * code - 6 digits or empty string. Default: empty string. If strings is |
27 // empty, random code is generated. | 27 // empty, random code is generated. |
28 // * device_name - string. Default: "Chromebox-01". | 28 // * device_name - string. Default: "Chromebox-01". |
29 // * domain - string. Default: "example.com". | 29 // * domain - string. Default: "example.com". |
30 explicit FakeHostPairingController(const std::string& config); | 30 explicit FakeHostPairingController(const std::string& config); |
31 virtual ~FakeHostPairingController(); | 31 ~FakeHostPairingController() override; |
32 | 32 |
33 // Applies given |config| to flow. | 33 // Applies given |config| to flow. |
34 void ApplyConfig(const std::string& config); | 34 void ApplyConfig(const std::string& config); |
35 | 35 |
36 private: | 36 private: |
37 void ChangeStage(Stage new_stage); | 37 void ChangeStage(Stage new_stage); |
38 void ChangeStageLater(Stage new_stage); | 38 void ChangeStageLater(Stage new_stage); |
39 | 39 |
40 // HostPairingController: | 40 // HostPairingController: |
41 virtual void AddObserver(Observer* observer) override; | 41 void AddObserver(Observer* observer) override; |
42 virtual void RemoveObserver(Observer* observer) override; | 42 void RemoveObserver(Observer* observer) override; |
43 virtual Stage GetCurrentStage() override; | 43 Stage GetCurrentStage() override; |
44 virtual void StartPairing() override; | 44 void StartPairing() override; |
45 virtual std::string GetDeviceName() override; | 45 std::string GetDeviceName() override; |
46 virtual std::string GetConfirmationCode() override; | 46 std::string GetConfirmationCode() override; |
47 virtual std::string GetEnrollmentDomain() override; | 47 std::string GetEnrollmentDomain() override; |
48 virtual void OnUpdateStatusChanged(UpdateStatus update_status) override; | 48 void OnUpdateStatusChanged(UpdateStatus update_status) override; |
49 virtual void OnEnrollmentStatusChanged( | 49 void OnEnrollmentStatusChanged(EnrollmentStatus enrollment_status) override; |
50 EnrollmentStatus enrollment_status) override; | |
51 | 50 |
52 // HostPairingController::Observer: | 51 // HostPairingController::Observer: |
53 virtual void PairingStageChanged(Stage new_stage) override; | 52 void PairingStageChanged(Stage new_stage) override; |
54 virtual void ConfigureHost(bool accepted_eula, | 53 void ConfigureHost(bool accepted_eula, |
55 const std::string& lang, | 54 const std::string& lang, |
56 const std::string& timezone, | 55 const std::string& timezone, |
57 bool send_reports, | 56 bool send_reports, |
58 const std::string& keyboard_layout) override; | 57 const std::string& keyboard_layout) override; |
59 virtual void EnrollHost(const std::string& auth_token) override; | 58 void EnrollHost(const std::string& auth_token) override; |
60 | 59 |
61 ObserverList<Observer> observers_; | 60 ObserverList<Observer> observers_; |
62 Stage current_stage_; | 61 Stage current_stage_; |
63 std::string device_name_; | 62 std::string device_name_; |
64 std::string confirmation_code_; | 63 std::string confirmation_code_; |
65 base::TimeDelta async_duration_; | 64 base::TimeDelta async_duration_; |
66 | 65 |
67 // If this flag is true error happens on |STAGE_ENROLLING| once. | 66 // If this flag is true error happens on |STAGE_ENROLLING| once. |
68 bool enrollment_should_fail_; | 67 bool enrollment_should_fail_; |
69 | 68 |
70 // Controller starts its work like if update and reboot already happened. | 69 // Controller starts its work like if update and reboot already happened. |
71 bool start_after_update_; | 70 bool start_after_update_; |
72 | 71 |
73 std::string enrollment_domain_; | 72 std::string enrollment_domain_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(FakeHostPairingController); | 74 DISALLOW_COPY_AND_ASSIGN(FakeHostPairingController); |
76 }; | 75 }; |
77 | 76 |
78 } // namespace pairing_chromeos | 77 } // namespace pairing_chromeos |
79 | 78 |
80 #endif // COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ | 79 #endif // COMPONENTS_PAIRING_FAKE_HOST_PAIRING_CONTROLLER_H_ |
OLD | NEW |