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_HOST_PAIRING_CONTROLLER_H_ | 5 #ifndef COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_ |
6 #define COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_ | 6 #define COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 UPDATE_STATUS_UPDATED, | 44 UPDATE_STATUS_UPDATED, |
45 }; | 45 }; |
46 | 46 |
47 enum EnrollmentStatus { | 47 enum EnrollmentStatus { |
48 ENROLLMENT_STATUS_UNKNOWN, | 48 ENROLLMENT_STATUS_UNKNOWN, |
49 ENROLLMENT_STATUS_ENROLLING, | 49 ENROLLMENT_STATUS_ENROLLING, |
50 ENROLLMENT_STATUS_FAILURE, | 50 ENROLLMENT_STATUS_FAILURE, |
51 ENROLLMENT_STATUS_SUCCESS, | 51 ENROLLMENT_STATUS_SUCCESS, |
52 }; | 52 }; |
53 | 53 |
| 54 enum class ErrorCode : int { |
| 55 ERROR_NONE = 0, |
| 56 NETWORK_ERROR, |
| 57 AUTH_ERROR, |
| 58 ENROLL_ERROR, |
| 59 OTHER_ERROR, |
| 60 }; |
| 61 |
54 class Observer { | 62 class Observer { |
55 public: | 63 public: |
56 Observer(); | 64 Observer(); |
57 virtual ~Observer(); | 65 virtual ~Observer(); |
58 | 66 |
59 // Called when pairing has moved on from one stage to another. | 67 // Called when pairing has moved on from one stage to another. |
60 virtual void PairingStageChanged(Stage new_stage) = 0; | 68 virtual void PairingStageChanged(Stage new_stage) = 0; |
61 | 69 |
62 // Called when the controller has sent a configuration to apply. | 70 // Called when the controller has sent a configuration to apply. |
63 virtual void ConfigureHostRequested(bool accepted_eula, | 71 virtual void ConfigureHostRequested(bool accepted_eula, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0; | 116 virtual void OnUpdateStatusChanged(UpdateStatus update_status) = 0; |
109 | 117 |
110 // Notify that enrollment status has changed. | 118 // Notify that enrollment status has changed. |
111 // Can be called on stage |STAGE_WAITING_FOR_CREDENTIALS|. | 119 // Can be called on stage |STAGE_WAITING_FOR_CREDENTIALS|. |
112 virtual void OnEnrollmentStatusChanged( | 120 virtual void OnEnrollmentStatusChanged( |
113 EnrollmentStatus enrollment_status) = 0; | 121 EnrollmentStatus enrollment_status) = 0; |
114 | 122 |
115 // Set the permanent id assigned during enrollment. | 123 // Set the permanent id assigned during enrollment. |
116 virtual void SetPermanentId(const std::string& permanent_id) = 0; | 124 virtual void SetPermanentId(const std::string& permanent_id) = 0; |
117 | 125 |
| 126 virtual void SetErrorCodeAndMessage(int error_code, |
| 127 const std::string& error_message) = 0; |
| 128 |
118 // Reset the controller. | 129 // Reset the controller. |
119 virtual void Reset() = 0; | 130 virtual void Reset() = 0; |
120 | 131 |
121 virtual void AddObserver(Observer* observer) = 0; | 132 virtual void AddObserver(Observer* observer) = 0; |
122 virtual void RemoveObserver(Observer* observer) = 0; | 133 virtual void RemoveObserver(Observer* observer) = 0; |
123 | 134 |
124 private: | 135 private: |
125 DISALLOW_COPY_AND_ASSIGN(HostPairingController); | 136 DISALLOW_COPY_AND_ASSIGN(HostPairingController); |
126 }; | 137 }; |
127 | 138 |
128 } // namespace pairing_chromeos | 139 } // namespace pairing_chromeos |
129 | 140 |
130 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_ | 141 #endif // COMPONENTS_PAIRING_HOST_PAIRING_CONTROLLER_H_ |
OLD | NEW |