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

Side by Side Diff: ui/chromeos/pairing/controller_pairing_flow.h

Issue 304603002: Created paring flow interface for controller side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added methods and notifications related to devices list. Created 6 years, 6 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 | « ui/chromeos/pairing/OWNERS ('k') | ui/chromeos/pairing/controller_pairing_flow.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 UI_CHROMEOS_PAIRING_CONTROLLER_PAIRING_FLOW_H_
6 #define UI_CHROMEOS_PAIRING_CONTROLLER_PAIRING_FLOW_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "ui/chromeos/ui_chromeos_export.h"
13
14 namespace chromeos {
15 class UserContext;
16 }
17
18 namespace content {
19 class BrowserContext;
20 }
21
22 namespace ui {
23
24 class UI_CHROMEOS_EXPORT ControllerPairingFlow {
25 public:
26 enum Stage {
27 STAGE_NONE,
28 STAGE_DEVICES_DISCOVERY,
29 STAGE_DEVICE_NOT_FOUND,
30 STAGE_ESTABLISHING_CONNECTION,
31 STAGE_WAITING_FOR_CODE_CONFIRMATION,
32 STAGE_HOST_UPDATE_IN_PROGRESS,
33 STAGE_HOST_CONNECTION_LOST,
34 STAGE_WAITING_FOR_CREDENTIALS,
35 STAGE_HOST_ENROLLMENT_IN_PROGRESS,
36 STAGE_HOST_ENROLLMENT_ERROR,
37 STAGE_PAIRING_DONE,
38 STAGE_STARTING_SESSION,
39 STAGE_FINISHED
40 };
41
42 class Observer {
43 public:
44 Observer();
45 virtual ~Observer();
46
47 // Called when flow 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_SCANNING_FOR_DEVICES| stage.
52 virtual void DiscoveredDevicesListChanged() = 0;
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(Observer);
56 };
57
58 typedef std::string DeviceID;
59
60 public:
61 ControllerPairingFlow();
62 virtual ~ControllerPairingFlow();
63
64 virtual void AddObserver(Observer* observer) = 0;
65 virtual void RemoveObserver(Observer* observer) = 0;
66
67 // Returns current stage of flow.
68 virtual Stage GetCurrentStage() = 0;
69
70 // Starts pairing flow. Can be called only on |STAGE_NONE| stage.
71 virtual void StartFlow() = 0;
72
73 // Returns list of discovered devices. Can be called only on
74 // |STAGE_DEVICES_DISCOVERY| stage.
75 virtual std::vector<DeviceID> GetDiscoveredDevices() = 0;
76
77 // This method is called to start pairing with the device having |device_id|
78 // ID. Can be called only on |STAGE_DEVICES_DISCOVERY| stage.
79 virtual void ChooseDeviceForPairing(const DeviceID& device_id) = 0;
80
81 // Rescan for devices to pair with. Can be called only on
82 // |STAGE_DEVICE_NOT_FOUND| stage.
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 SetConfirmationCodeIsRight(bool right) = 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;
stevenjb 2014/05/29 16:06:55 WS
102 private:
103 DISALLOW_COPY_AND_ASSIGN(ControllerPairingFlow);
104 };
105
106 } // namespace ui
107
108 #endif // UI_CHROMEOS_PAIRING_CONTROLLER_PAIRING_FLOW_H_
OLDNEW
« no previous file with comments | « ui/chromeos/pairing/OWNERS ('k') | ui/chromeos/pairing/controller_pairing_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698