Update parsing of dumpsys batterystats
[chromium-blink-merge.git] / components / pairing / controller_pairing_controller.h
blob67ec581604f633b8c3ef118c8eeee3c367c32bf1
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.
5 #ifndef COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
6 #define COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_
8 #include <string>
9 #include <vector>
11 #include "base/macros.h"
13 namespace chromeos {
14 class UserContext;
17 namespace content {
18 class BrowserContext;
21 namespace pairing_chromeos {
23 class ControllerPairingController {
24 public:
25 enum Stage {
26 STAGE_NONE,
27 STAGE_DEVICES_DISCOVERY,
28 STAGE_DEVICE_NOT_FOUND,
29 STAGE_ESTABLISHING_CONNECTION,
30 STAGE_ESTABLISHING_CONNECTION_ERROR,
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_FINISHED
41 class Observer {
42 public:
43 Observer();
44 virtual ~Observer();
46 // Called when pairing has moved on from one stage to another.
47 virtual void PairingStageChanged(Stage new_stage) = 0;
49 // Called when new device was discovered or existing device was lost.
50 // This notification is made only on |STAGE_DEVICES_DISCOVERY| stage.
51 virtual void DiscoveredDevicesListChanged() = 0;
53 private:
54 DISALLOW_COPY_AND_ASSIGN(Observer);
57 typedef std::vector<std::string> DeviceIdList;
59 ControllerPairingController();
60 virtual ~ControllerPairingController();
62 virtual void AddObserver(Observer* observer) = 0;
63 virtual void RemoveObserver(Observer* observer) = 0;
65 // Returns current stage of pairing process.
66 virtual Stage GetCurrentStage() = 0;
68 // Starts pairing process. Can be called only on |STAGE_NONE| stage.
69 virtual void StartPairing() = 0;
71 // Returns list of discovered devices. Can be called only on
72 // |STAGE_DEVICES_DISCOVERY| stage.
73 virtual DeviceIdList GetDiscoveredDevices() = 0;
75 // 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 virtual void ChooseDeviceForPairing(const std::string& device_id) = 0;
79 // Rescan for devices to pair with. Can be called only on
80 // stages |STAGE_DEVICE_NOT_FOUND|, |STAGE_ESTABLISHING_CONNECTION_ERROR|,
81 // |STAGE_HOST_ENROLLMENT_ERROR|.
82 virtual void RepeatDiscovery() = 0;
84 // Returns pairing confirmation code.
85 // Could be called only on |STATE_WAITING_FOR_CODE_CONFIRMATION| stage.
86 virtual std::string GetConfirmationCode() = 0;
88 // Called to confirm or deny confirmation code. Can be called only on
89 // |STAGE_WAITING_FOR_CODE_CONFIRMATION| stage.
90 virtual void SetConfirmationCodeIsCorrect(bool correct) = 0;
92 // Called when user successfully authenticated on GAIA page. Can be called
93 // only on |STAGE_WAITING_FOR_CREDENTIALS| stage.
94 virtual void OnAuthenticationDone(
95 const chromeos::UserContext& user_context,
96 content::BrowserContext* browser_context) = 0;
98 // Installs app and starts session.
99 // Can be called only on |STAGE_PAIRING_DONE| stage.
100 virtual void StartSession() = 0;
102 private:
103 DISALLOW_COPY_AND_ASSIGN(ControllerPairingController);
106 } // namespace pairing_chromeos
108 #endif // COMPONENTS_PAIRING_CONTROLLER_PAIRING_CONTROLLER_H_