Don't send a SHChangeNotify for creating an app icon when creating a shortcut.
[chromium-blink-merge.git] / components / pairing / bluetooth_controller_pairing_controller.h
blobc4a3258d9280ae509f75a5a00a23c5db8897d04a
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 CHROMEOS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_FLOW_H_
6 #define CHROMEOS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_FLOW_H_
8 #include <set>
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h"
13 #include "base/threading/thread_checker.h"
14 #include "components/pairing/controller_pairing_controller.h"
15 #include "components/pairing/proto_decoder.h"
16 #include "device/bluetooth/bluetooth_adapter.h"
17 #include "device/bluetooth/bluetooth_device.h"
18 #include "device/bluetooth/bluetooth_socket.h"
20 namespace net {
21 class IOBuffer;
24 namespace pairing_chromeos {
26 class BluetoothControllerPairingController
27 : public ControllerPairingController,
28 public ProtoDecoder::Observer,
29 public device::BluetoothAdapter::Observer,
30 public device::BluetoothDevice::PairingDelegate {
31 public:
32 BluetoothControllerPairingController();
33 ~BluetoothControllerPairingController() override;
35 private:
36 void ChangeStage(Stage new_stage);
37 device::BluetoothDevice* GetController();
38 void Reset();
39 void DeviceFound(device::BluetoothDevice* device);
40 void DeviceLost(device::BluetoothDevice* device);
41 void SendBuffer(scoped_refptr<net::IOBuffer> io_buffer, int size);
42 void CompleteSetup();
44 void OnSetPowered();
45 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
46 void OnStartDiscoverySession(
47 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
48 void OnConnect();
49 void OnConnectToService(scoped_refptr<device::BluetoothSocket> socket);
50 void OnSendComplete(int bytes_sent);
51 void OnReceiveComplete(int bytes, scoped_refptr<net::IOBuffer> io_buffer);
53 void OnError();
54 void OnErrorWithMessage(const std::string& message);
55 void OnConnectError(device::BluetoothDevice::ConnectErrorCode error_code);
56 void OnReceiveError(device::BluetoothSocket::ErrorReason reason,
57 const std::string& error_message);
59 // ControllerPairingController:
60 void AddObserver(ControllerPairingController::Observer* observer) override;
61 void RemoveObserver(ControllerPairingController::Observer* observer) override;
62 Stage GetCurrentStage() override;
63 void StartPairing() override;
64 DeviceIdList GetDiscoveredDevices() override;
65 void ChooseDeviceForPairing(const std::string& device_id) override;
66 void RepeatDiscovery() override;
67 std::string GetConfirmationCode() override;
68 void SetConfirmationCodeIsCorrect(bool correct) override;
69 void SetHostConfiguration(bool accepted_eula,
70 const std::string& lang,
71 const std::string& timezone,
72 bool send_reports,
73 const std::string& keyboard_layout) override;
74 void OnAuthenticationDone(const std::string& domain,
75 const std::string& auth_token) override;
76 void StartSession() override;
78 // ProtoDecoder::Observer:
79 void OnHostStatusMessage(const pairing_api::HostStatus& message) override;
80 void OnConfigureHostMessage(
81 const pairing_api::ConfigureHost& message) override;
82 void OnPairDevicesMessage(const pairing_api::PairDevices& message) override;
83 void OnCompleteSetupMessage(
84 const pairing_api::CompleteSetup& message) override;
85 void OnErrorMessage(const pairing_api::Error& message) override;
87 // BluetoothAdapter::Observer:
88 void DeviceAdded(device::BluetoothAdapter* adapter,
89 device::BluetoothDevice* device) override;
90 void DeviceRemoved(device::BluetoothAdapter* adapter,
91 device::BluetoothDevice* device) override;
93 // device::BluetoothDevice::PairingDelegate:
94 void RequestPinCode(device::BluetoothDevice* device) override;
95 void RequestPasskey(device::BluetoothDevice* device) override;
96 void DisplayPinCode(device::BluetoothDevice* device,
97 const std::string& pincode) override;
98 void DisplayPasskey(device::BluetoothDevice* device, uint32 passkey) override;
99 void KeysEntered(device::BluetoothDevice* device, uint32 entered) override;
100 void ConfirmPasskey(device::BluetoothDevice* device, uint32 passkey) override;
101 void AuthorizePairing(device::BluetoothDevice* device) override;
103 Stage current_stage_;
104 scoped_refptr<device::BluetoothAdapter> adapter_;
105 scoped_ptr<device::BluetoothDiscoverySession> discovery_session_;
106 scoped_refptr<device::BluetoothSocket> socket_;
107 std::string controller_device_id_;
109 std::string confirmation_code_;
110 std::set<std::string> discovered_devices_;
112 scoped_ptr<ProtoDecoder> proto_decoder_;
114 base::ThreadChecker thread_checker_;
115 ObserverList<ControllerPairingController::Observer> observers_;
116 base::WeakPtrFactory<BluetoothControllerPairingController> ptr_factory_;
118 DISALLOW_COPY_AND_ASSIGN(BluetoothControllerPairingController);
121 } // namespace pairing_chromeos
123 #endif // CHROMEOS_PAIRING_BLUETOOTH_CONTROLLER_PAIRING_FLOW_H_