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