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_CONTROLLER_PAIRING_CONTROLLER_H_ | 5 #ifndef COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ |
6 #define COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ | 6 #define COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 | 12 |
13 namespace chromeos { | 13 namespace chromeos { |
14 class UserContext; | 14 class UserContext; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class BrowserContext; | 18 class BrowserContext; |
19 } | 19 } |
20 | 20 |
21 namespace pairing_chromeos { | 21 namespace pairing_chromeos { |
22 | 22 |
23 class ControllerPairingController { | 23 class ControllerPairingController { |
24 public: | 24 public: |
25 enum Stage { | 25 enum Stage { |
26 STAGE_NONE, | 26 STAGE_NONE, |
27 STAGE_INITIALIZATION_ERROR, | |
27 STAGE_DEVICES_DISCOVERY, | 28 STAGE_DEVICES_DISCOVERY, |
28 STAGE_DEVICE_NOT_FOUND, | 29 STAGE_DEVICE_NOT_FOUND, |
29 STAGE_ESTABLISHING_CONNECTION, | 30 STAGE_ESTABLISHING_CONNECTION, |
30 STAGE_ESTABLISHING_CONNECTION_ERROR, | 31 STAGE_ESTABLISHING_CONNECTION_ERROR, |
31 STAGE_WAITING_FOR_CODE_CONFIRMATION, | 32 STAGE_WAITING_FOR_CODE_CONFIRMATION, |
32 STAGE_HOST_UPDATE_IN_PROGRESS, | 33 STAGE_HOST_UPDATE_IN_PROGRESS, |
33 STAGE_HOST_CONNECTION_LOST, | 34 STAGE_HOST_CONNECTION_LOST, |
34 STAGE_WAITING_FOR_CREDENTIALS, | 35 STAGE_WAITING_FOR_CREDENTIALS, |
35 STAGE_HOST_ENROLLMENT_IN_PROGRESS, | 36 STAGE_HOST_ENROLLMENT_IN_PROGRESS, |
36 STAGE_HOST_ENROLLMENT_ERROR, | 37 STAGE_HOST_ENROLLMENT_ERROR, |
(...skipping 15 matching lines...) Expand all Loading... | |
52 | 53 |
53 private: | 54 private: |
54 DISALLOW_COPY_AND_ASSIGN(Observer); | 55 DISALLOW_COPY_AND_ASSIGN(Observer); |
55 }; | 56 }; |
56 | 57 |
57 typedef std::vector<std::string> DeviceIdList; | 58 typedef std::vector<std::string> DeviceIdList; |
58 | 59 |
59 ControllerPairingController(); | 60 ControllerPairingController(); |
60 virtual ~ControllerPairingController(); | 61 virtual ~ControllerPairingController(); |
61 | 62 |
62 virtual void AddObserver(Observer* observer) = 0; | 63 virtual void AddObserver(Observer* observer) = 0; |
achuithb
2014/08/20 23:28:13
Same comment about AddObserver/RemoveObserver as t
Zachary Kuznia
2014/08/20 23:34:23
Done.
| |
63 virtual void RemoveObserver(Observer* observer) = 0; | 64 virtual void RemoveObserver(Observer* observer) = 0; |
64 | 65 |
65 // Returns current stage of pairing process. | 66 // Returns current stage of pairing process. |
66 virtual Stage GetCurrentStage() = 0; | 67 virtual Stage GetCurrentStage() = 0; |
67 | 68 |
68 // Starts pairing process. Can be called only on |STAGE_NONE| stage. | 69 // Starts pairing process. Can be called only on |STAGE_NONE| stage. |
69 virtual void StartPairing() = 0; | 70 virtual void StartPairing() = 0; |
70 | 71 |
71 // Returns list of discovered devices. Can be called only on | 72 // Returns list of discovered devices. Can be called only on |
72 // |STAGE_DEVICES_DISCOVERY| stage. | 73 // |STAGE_DEVICES_DISCOVERY| stage. |
73 virtual DeviceIdList GetDiscoveredDevices() = 0; | 74 virtual DeviceIdList GetDiscoveredDevices() = 0; |
74 | 75 |
75 // This method is called to start pairing with the device having |device_id| | 76 // This method is called to start pairing with the device having |device_id| |
76 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage. | 77 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage. |
77 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0; | 78 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0; |
78 | 79 |
79 // Rescan for devices to pair with. Can be called only on | 80 // Rescan for devices to pair with. Can be called only on |
80 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|, | 81 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|, |
81 // |STAGE_HOST_ENROLLMENT_ERROR|. | 82 // |STAGE_HOST_ENROLLMENT_ERROR|. |
82 virtual void RepeatDiscovery() = 0; | 83 virtual void RepeatDiscovery() = 0; |
83 | 84 |
84 // Returns pairing confirmation code. | 85 // Returns pairing confirmation code. |
85 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage. | 86 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage. |
86 virtual std::string GetConfirmationCode() = 0; | 87 virtual std::string GetConfirmationCode() = 0; |
87 | 88 |
88 // Called to confirm or deny confirmation code. Can be called only on | 89 // Called to confirm or deny confirmation code. Can be called only on |
89 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage. | 90 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage. |
90 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0; | 91 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0; |
91 | 92 |
93 // Set the values that will be sent to the Host if it needs to be configured. | |
94 virtual void SetHostConfiguration(bool accepted_eula, | |
95 const std::string& lang, | |
96 const std::string& timezone, | |
97 bool send_reports, | |
98 const std::string& keyboard_layout) = 0; | |
99 | |
100 virtual Stage GetCurrentStage() = 0; | |
92 // Called when user successfully authenticated on GAIA page. Can be called | 101 // Called when user successfully authenticated on GAIA page. Can be called |
93 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage. | 102 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage. |
94 virtual void OnAuthenticationDone( | 103 // |auth_token| will be sent to the host to be used for enrollment. |
95 const chromeos::UserContext& user_context, | 104 virtual void OnAuthenticationDone(const std::string& auth_token) = 0; |
96 content::BrowserContext* browser_context) = 0; | |
97 | 105 |
98 // Installs app and starts session. | 106 // Installs app and starts session. |
99 // Can be called only on |STAGE_PAIRING_DONE| stage. | 107 // Can be called only on |STAGE_PAIRING_DONE| stage. |
100 virtual void StartSession() = 0; | 108 virtual void StartSession() = 0; |
101 | 109 |
102 private: | 110 private: |
103 DISALLOW_COPY_AND_ASSIGN(ControllerPairingController); | 111 DISALLOW_COPY_AND_ASSIGN(ControllerPairingController); |
104 }; | 112 }; |
105 | 113 |
106 } // namespace pairing_chromeos | 114 } // namespace pairing_chromeos |
107 | 115 |
108 #endif // COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ | 116 #endif // COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_ |
OLD | NEW |