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

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

Issue 387163002: Move Chrome OS pairing interface to chrome/browser/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compoent -> source set Created 6 years, 5 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
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/pairing/controller_pairing_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
6 #define CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "chromeos/chromeos_export.h"
13
14 namespace chromeos {
15 class UserContext;
16 }
17
18 namespace content {
19 class BrowserContext;
20 }
21
22 namespace chromeos {
23
24 class CHROMEOS_EXPORT ControllerPairingController {
25 public:
26 enum Stage {
27 STAGE_NONE,
28 STAGE_DEVICES_DISCOVERY,
29 STAGE_DEVICE_NOT_FOUND,
30 STAGE_ESTABLISHING_CONNECTION,
31 STAGE_ESTABLISHING_CONNECTION_ERROR,
32 STAGE_WAITING_FOR_CODE_CONFIRMATION,
33 STAGE_HOST_UPDATE_IN_PROGRESS,
34 STAGE_HOST_CONNECTION_LOST,
35 STAGE_WAITING_FOR_CREDENTIALS,
36 STAGE_HOST_ENROLLMENT_IN_PROGRESS,
37 STAGE_HOST_ENROLLMENT_ERROR,
38 STAGE_PAIRING_DONE,
39 STAGE_FINISHED
40 };
41
42 class Observer {
43 public:
44 Observer();
45 virtual ~Observer();
46
47 // Called when pairing has moved on from one stage to another.
48 virtual void PairingStageChanged(Stage new_stage) = 0;
49
50 // Called when new device was discovered or existing device was lost.
51 // This notification is made only on |STAGE_DEVICES_DISCOVERY| stage.
52 virtual void DiscoveredDevicesListChanged() = 0;
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(Observer);
56 };
57
58 typedef std::vector<std::string> DeviceIdList;
59
60 ControllerPairingController();
61 virtual ~ControllerPairingController();
62
63 virtual void AddObserver(Observer* observer) = 0;
64 virtual void RemoveObserver(Observer* observer) = 0;
65
66 // Returns current stage of pairing process.
67 virtual Stage GetCurrentStage() = 0;
68
69 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
70 virtual void StartPairing() = 0;
71
72 // Returns list of discovered devices. Can be called only on
73 // |STAGE_DEVICES_DISCOVERY| stage.
74 virtual DeviceIdList GetDiscoveredDevices() = 0;
75
76 // This method is called to start pairing with the device having |device_id|
77 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage.
78 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0;
79
80 // Rescan for devices to pair with. Can be called only on
81 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|,
82 // |STAGE_HOST_ENROLLMENT_ERROR|.
83 virtual void RepeatDiscovery() = 0;
84
85 // Returns pairing confirmation code.
86 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage.
87 virtual std::string GetConfirmationCode() = 0;
88
89 // Called to confirm or deny confirmation code. Can be called only on
90 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
91 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0;
92
93 // Called when user successfully authenticated on GAIA page. Can be called
94 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage.
95 virtual void OnAuthenticationDone(
96 const chromeos::UserContext& user_context,
97 content::BrowserContext* browser_context) = 0;
98
99 // Installs app and starts session.
100 // Can be called only on |STAGE_PAIRING_DONE| stage.
101 virtual void StartSession() = 0;
102
103 private:
104 DISALLOW_COPY_AND_ASSIGN(ControllerPairingController);
105 };
106
107 } // namespace chromeos
108
109 #endif // CHROMEOS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
OLDNEW
« no previous file with comments | « chromeos/chromeos.gyp ('k') | chromeos/pairing/controller_pairing_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698