Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: components/pairing/controller_pairing_controller.h

Issue 491943004: Update the pairing API to include configuration and enrollment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment some TODOs Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 RemoveObserver(Observer* observer) = 0;
64
65 // Returns current stage of pairing process. 63 // Returns current stage of pairing process.
66 virtual Stage GetCurrentStage() = 0; 64 virtual Stage GetCurrentStage() = 0;
67 65
68 // Starts pairing process. Can be called only on |STAGE_NONE| stage. 66 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
69 virtual void StartPairing() = 0; 67 virtual void StartPairing() = 0;
70 68
71 // Returns list of discovered devices. Can be called only on 69 // Returns list of discovered devices. Can be called only on
72 // |STAGE_DEVICES_DISCOVERY| stage. 70 // |STAGE_DEVICES_DISCOVERY| stage.
73 virtual DeviceIdList GetDiscoveredDevices() = 0; 71 virtual DeviceIdList GetDiscoveredDevices() = 0;
74 72
75 // This method is called to start pairing with the device having |device_id| 73 // This method is called to start pairing with the device having |device_id|
76 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage. 74 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage.
77 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0; 75 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0;
78 76
79 // Rescan for devices to pair with. Can be called only on 77 // Rescan for devices to pair with. Can be called only on
80 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|, 78 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|,
81 // |STAGE_HOST_ENROLLMENT_ERROR|. 79 // |STAGE_HOST_ENROLLMENT_ERROR|.
82 virtual void RepeatDiscovery() = 0; 80 virtual void RepeatDiscovery() = 0;
83 81
84 // Returns pairing confirmation code. 82 // Returns pairing confirmation code.
85 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage. 83 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage.
86 virtual std::string GetConfirmationCode() = 0; 84 virtual std::string GetConfirmationCode() = 0;
87 85
88 // Called to confirm or deny confirmation code. Can be called only on 86 // Called to confirm or deny confirmation code. Can be called only on
89 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage. 87 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
90 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0; 88 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0;
91 89
90 // Set the values that will be sent to the Host if it needs to be configured.
achuithb 2014/08/27 21:41:36 s/Host/host
Zachary Kuznia 2014/08/27 22:01:49 Done.
91 virtual void SetHostConfiguration(bool accepted_eula,
92 const std::string& lang,
93 const std::string& timezone,
94 bool send_reports,
95 const std::string& keyboard_layout) = 0;
96
92 // Called when user successfully authenticated on GAIA page. Can be called 97 // Called when user successfully authenticated on GAIA page. Can be called
93 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage. 98 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage.
94 virtual void OnAuthenticationDone( 99 // |auth_token| will be sent to the host to be used for enrollment.
95 const chromeos::UserContext& user_context, 100 virtual void OnAuthenticationDone(const std::string& domain,
96 content::BrowserContext* browser_context) = 0; 101 const std::string& auth_token) = 0;
97 102
98 // Installs app and starts session. 103 // Installs app and starts session.
99 // Can be called only on |STAGE_PAIRING_DONE| stage. 104 // Can be called only on |STAGE_PAIRING_DONE| stage.
100 virtual void StartSession() = 0; 105 virtual void StartSession() = 0;
101 106
107 virtual void AddObserver(Observer* observer) = 0;
108 virtual void RemoveObserver(Observer* observer) = 0;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698