| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ | 5 #ifndef ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ |
| 6 #define ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ | 6 #define ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
| 16 #include "device/bluetooth/bluetooth_adapter.h" | 16 #include "device/bluetooth/bluetooth_adapter.h" |
| 17 #include "device/bluetooth/bluetooth_device.h" | 17 #include "device/bluetooth/bluetooth_device.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 // The BluetoothNotificationController receives incoming pairing requests from | 21 // The BluetoothNotificationController receives incoming pairing requests from |
| 22 // the BluetoothAdapter, and notifications of changes to the adapter state and | 22 // the BluetoothAdapter, and notifications of changes to the adapter state and |
| 23 // set of paired devices. It presents incoming pairing requests in the form of | 23 // set of paired devices. It presents incoming pairing requests in the form of |
| 24 // rich notifications that the user can interact with to approve the request. | 24 // rich notifications that the user can interact with to approve the request. |
| 25 class ASH_EXPORT BluetoothNotificationController | 25 class ASH_EXPORT BluetoothNotificationController |
| 26 : public device::BluetoothAdapter::Observer, | 26 : public device::BluetoothAdapter::Observer, |
| 27 public device::BluetoothDevice::PairingDelegate { | 27 public device::BluetoothDevice::PairingDelegate { |
| 28 public: | 28 public: |
| 29 BluetoothNotificationController(); | 29 BluetoothNotificationController(); |
| 30 virtual ~BluetoothNotificationController(); | 30 ~BluetoothNotificationController() override; |
| 31 | 31 |
| 32 // device::BluetoothAdapter::Observer override. | 32 // device::BluetoothAdapter::Observer override. |
| 33 virtual void AdapterDiscoverableChanged(device::BluetoothAdapter* adapter, | 33 void AdapterDiscoverableChanged(device::BluetoothAdapter* adapter, |
| 34 bool discoverable) override; | 34 bool discoverable) override; |
| 35 virtual void DeviceAdded(device::BluetoothAdapter* adapter, | 35 void DeviceAdded(device::BluetoothAdapter* adapter, |
| 36 device::BluetoothDevice* device) override; | 36 device::BluetoothDevice* device) override; |
| 37 virtual void DeviceChanged(device::BluetoothAdapter* adapter, | 37 void DeviceChanged(device::BluetoothAdapter* adapter, |
| 38 device::BluetoothDevice* device) override; | 38 device::BluetoothDevice* device) override; |
| 39 virtual void DeviceRemoved(device::BluetoothAdapter* adapter, | 39 void DeviceRemoved(device::BluetoothAdapter* adapter, |
| 40 device::BluetoothDevice* device) override; | 40 device::BluetoothDevice* device) override; |
| 41 | 41 |
| 42 // device::BluetoothDevice::PairingDelegate override. | 42 // device::BluetoothDevice::PairingDelegate override. |
| 43 virtual void RequestPinCode(device::BluetoothDevice* device) override; | 43 void RequestPinCode(device::BluetoothDevice* device) override; |
| 44 virtual void RequestPasskey(device::BluetoothDevice* device) override; | 44 void RequestPasskey(device::BluetoothDevice* device) override; |
| 45 virtual void DisplayPinCode(device::BluetoothDevice* device, | 45 void DisplayPinCode(device::BluetoothDevice* device, |
| 46 const std::string& pincode) override; | 46 const std::string& pincode) override; |
| 47 virtual void DisplayPasskey(device::BluetoothDevice* device, | 47 void DisplayPasskey(device::BluetoothDevice* device, uint32 passkey) override; |
| 48 uint32 passkey) override; | 48 void KeysEntered(device::BluetoothDevice* device, uint32 entered) override; |
| 49 virtual void KeysEntered(device::BluetoothDevice* device, | 49 void ConfirmPasskey(device::BluetoothDevice* device, uint32 passkey) override; |
| 50 uint32 entered) override; | 50 void AuthorizePairing(device::BluetoothDevice* device) override; |
| 51 virtual void ConfirmPasskey(device::BluetoothDevice* device, | |
| 52 uint32 passkey) override; | |
| 53 virtual void AuthorizePairing(device::BluetoothDevice* device) override; | |
| 54 | 51 |
| 55 private: | 52 private: |
| 56 // Internal method called by BluetoothAdapterFactory to provide the adapter | 53 // Internal method called by BluetoothAdapterFactory to provide the adapter |
| 57 // object. | 54 // object. |
| 58 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | 55 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
| 59 | 56 |
| 60 // Presents a notification to the user when the adapter becomes discoverable | 57 // Presents a notification to the user when the adapter becomes discoverable |
| 61 // to other nearby devices. | 58 // to other nearby devices. |
| 62 void NotifyAdapterDiscoverable(); | 59 void NotifyAdapterDiscoverable(); |
| 63 | 60 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 84 // Note: This should remain the last member so it'll be destroyed and | 81 // Note: This should remain the last member so it'll be destroyed and |
| 85 // invalidate its weak pointers before any other members are destroyed. | 82 // invalidate its weak pointers before any other members are destroyed. |
| 86 base::WeakPtrFactory<BluetoothNotificationController> weak_ptr_factory_; | 83 base::WeakPtrFactory<BluetoothNotificationController> weak_ptr_factory_; |
| 87 | 84 |
| 88 DISALLOW_COPY_AND_ASSIGN(BluetoothNotificationController); | 85 DISALLOW_COPY_AND_ASSIGN(BluetoothNotificationController); |
| 89 }; | 86 }; |
| 90 | 87 |
| 91 } // namespace ash | 88 } // namespace ash |
| 92 | 89 |
| 93 #endif // ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ | 90 #endif // ASH_SYSTEM_CHROMEOS_BLUETOOTH_BLUETOOTH_NOTIFICATION_CONTROLLER_H_ |
| OLD | NEW |