| 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 EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ |
| 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
| 11 #include "extensions/common/api/bluetooth_private.h" | 11 #include "extensions/common/api/bluetooth_private.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 class BrowserContext; | 14 class BrowserContext; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace extensions { | 17 namespace extensions { |
| 18 | 18 |
| 19 // A pairing delegate to dispatch incoming Bluetooth pairing events to the API | 19 // A pairing delegate to dispatch incoming Bluetooth pairing events to the API |
| 20 // event router. | 20 // event router. |
| 21 class BluetoothApiPairingDelegate | 21 class BluetoothApiPairingDelegate |
| 22 : public device::BluetoothDevice::PairingDelegate { | 22 : public device::BluetoothDevice::PairingDelegate { |
| 23 public: | 23 public: |
| 24 BluetoothApiPairingDelegate(const std::string& extension_id, | 24 BluetoothApiPairingDelegate(const std::string& extension_id, |
| 25 content::BrowserContext* browser_context); | 25 content::BrowserContext* browser_context); |
| 26 virtual ~BluetoothApiPairingDelegate(); | 26 virtual ~BluetoothApiPairingDelegate(); |
| 27 | 27 |
| 28 // device::PairingDelegate overrides: | 28 // device::PairingDelegate overrides: |
| 29 virtual void RequestPinCode(device::BluetoothDevice* device) OVERRIDE; | 29 virtual void RequestPinCode(device::BluetoothDevice* device) override; |
| 30 virtual void RequestPasskey(device::BluetoothDevice* device) OVERRIDE; | 30 virtual void RequestPasskey(device::BluetoothDevice* device) override; |
| 31 virtual void DisplayPinCode(device::BluetoothDevice* device, | 31 virtual void DisplayPinCode(device::BluetoothDevice* device, |
| 32 const std::string& pincode) OVERRIDE; | 32 const std::string& pincode) override; |
| 33 virtual void DisplayPasskey(device::BluetoothDevice* device, | 33 virtual void DisplayPasskey(device::BluetoothDevice* device, |
| 34 uint32 passkey) OVERRIDE; | 34 uint32 passkey) override; |
| 35 virtual void KeysEntered(device::BluetoothDevice* device, | 35 virtual void KeysEntered(device::BluetoothDevice* device, |
| 36 uint32 entered) OVERRIDE; | 36 uint32 entered) override; |
| 37 virtual void ConfirmPasskey(device::BluetoothDevice* device, | 37 virtual void ConfirmPasskey(device::BluetoothDevice* device, |
| 38 uint32 passkey) OVERRIDE; | 38 uint32 passkey) override; |
| 39 virtual void AuthorizePairing(device::BluetoothDevice* device) OVERRIDE; | 39 virtual void AuthorizePairing(device::BluetoothDevice* device) override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 // Dispatches a pairing event to the extension. | 42 // Dispatches a pairing event to the extension. |
| 43 void DispatchPairingEvent( | 43 void DispatchPairingEvent( |
| 44 const core_api::bluetooth_private::PairingEvent& pairing_event); | 44 const core_api::bluetooth_private::PairingEvent& pairing_event); |
| 45 | 45 |
| 46 std::string extension_id_; | 46 std::string extension_id_; |
| 47 content::BrowserContext* browser_context_; | 47 content::BrowserContext* browser_context_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace extensions | 50 } // namespace extensions |
| 51 | 51 |
| 52 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ | 52 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_BLUETOOTH_API_PAIRING_DELEGATE_H_ |
| OLD | NEW |