OLD | NEW |
---|---|
(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 | |
10 #include "base/macros.h" | |
11 #include "ui/chromeos/ui_chromeos_export.h" | |
12 | |
13 namespace chromeos { | |
14 class UserContext; | |
15 } | |
16 | |
17 namespace content { | |
18 class BrowserContext; | |
19 } | |
20 | |
21 namespace ui { | |
22 | |
23 class UI_CHROMEOS_EXPORT ControllerPairingFlow { | |
24 public: | |
25 enum Stage { | |
26 STAGE_NONE, | |
27 STAGE_SCANNING_FOR_DEVICES, | |
28 STAGE_DEVICE_NOT_FOUND, | |
29 STAGE_WAITING_FOR_DEVICE_SELECTION, | |
30 STAGE_ESTABLISHING_CONNECTION, | |
31 STAGE_WATING_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 virtual ~Observer() {}; | |
45 | |
46 // Called when flow has moved on from one stage to another. | |
47 virtual void PairingStageChanged(Stage previous_stage, Stage new_stage) = 0; | |
Zachary Kuznia
2014/05/27 23:46:43
Why do you expect the previous stage to be sent he
dzhioev (left Google)
2014/05/28 10:38:30
Yes, probably |previous_stage| is excess.
| |
48 | |
49 private: | |
50 DISALLOW_COPY_AND_ASSIGN(Observer); | |
51 }; | |
52 | |
53 public: | |
54 virtual ~ControllerPairingFlow() {} | |
55 | |
56 virtual void AddObserver(Observer* observer) = 0; | |
57 virtual void RemoveObserver(Observer* observer) = 0; | |
58 | |
59 // Returns current stage of flow. | |
60 virtual Stage GetCurrentStage() = 0; | |
61 | |
62 // Starts pairing flow. Can be called only on |STAGE_NONE| stage. | |
63 virtual void StartFlow() = 0; | |
64 | |
65 // Rescan for devices to pair with. Can be called only on | |
66 // |STAGE_DEVICE_NOT_FOUND| stage. | |
67 virtual void RepeatScanning() = 0; | |
68 | |
69 // Called to confirm or deny confirmation code. Can be called only on | |
70 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage. | |
71 virtual void SetConfirmationCodeIsRight(bool right) = 0; | |
72 | |
73 // Called when user successfully authenticated on GAIA page. Can be called | |
74 // only on |STAGE_WAITING_FOR_CREDENTIALS|. | |
75 virtual void OnAuthenticationDone( | |
76 const chromeos::UserContext& user_context, | |
77 content::BrowserContext* browser_context) = 0; | |
78 | |
79 // Installs app and starts session. | |
80 // Can be called only on |STAGE_PAIRING_DONE| stage. | |
81 virtual void StartSession() = 0; | |
82 | |
83 // Returns pairing confirmation code. | |
84 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage. | |
85 virtual std::string GetConfirmationCode() = 0; | |
86 | |
87 private: | |
88 DISALLOW_COPY_AND_ASSIGN(ControllerPairingFlow); | |
89 }; | |
90 | |
91 } // namespace ui | |
92 | |
93 #endif // UI_CHROMEOS_PAIRING_CONTROLLER_PAIRING_FLOW_H_ | |
OLD | NEW |