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 CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENERGY_
API_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_event_router.h" | 9 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ
y_event_router.h" |
10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Implemented by individual bluetoothLowEnergy extension functions to perform | 67 // Implemented by individual bluetoothLowEnergy extension functions to perform |
68 // the body of the function. This invoked asynchonously after RunAsync after | 68 // the body of the function. This invoked asynchonously after RunAsync after |
69 // the BluetoothLowEnergyEventRouter has obtained a handle on the | 69 // the BluetoothLowEnergyEventRouter has obtained a handle on the |
70 // BluetoothAdapter. | 70 // BluetoothAdapter. |
71 virtual bool DoWork() = 0; | 71 virtual bool DoWork() = 0; |
72 | 72 |
73 private: | 73 private: |
74 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyExtensionFunction); | 74 DISALLOW_COPY_AND_ASSIGN(BluetoothLowEnergyExtensionFunction); |
75 }; | 75 }; |
76 | 76 |
| 77 class BluetoothLowEnergyConnectFunction |
| 78 : public BluetoothLowEnergyExtensionFunction { |
| 79 public: |
| 80 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.connect", |
| 81 BLUETOOTHLOWENERGY_CONNECT); |
| 82 |
| 83 protected: |
| 84 virtual ~BluetoothLowEnergyConnectFunction() {} |
| 85 |
| 86 // BluetoothLowEnergyExtensionFunction override. |
| 87 virtual bool DoWork() OVERRIDE; |
| 88 |
| 89 private: |
| 90 // Success and error callbacks, called by |
| 91 // BluetoothLowEnergyEventRouter::Connect. |
| 92 void SuccessCallback(); |
| 93 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 94 }; |
| 95 |
| 96 class BluetoothLowEnergyDisconnectFunction |
| 97 : public BluetoothLowEnergyExtensionFunction { |
| 98 public: |
| 99 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.disconnect", |
| 100 BLUETOOTHLOWENERGY_DISCONNECT); |
| 101 |
| 102 protected: |
| 103 virtual ~BluetoothLowEnergyDisconnectFunction() {} |
| 104 |
| 105 // BluetoothLowEnergyExtensionFunction override. |
| 106 virtual bool DoWork() OVERRIDE; |
| 107 |
| 108 private: |
| 109 // Success and error callbacks, called by |
| 110 // BluetoothLowEnergyEventRouter::Disconnect. |
| 111 void SuccessCallback(); |
| 112 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
| 113 }; |
| 114 |
77 class BluetoothLowEnergyGetServiceFunction | 115 class BluetoothLowEnergyGetServiceFunction |
78 : public BluetoothLowEnergyExtensionFunction { | 116 : public BluetoothLowEnergyExtensionFunction { |
79 public: | 117 public: |
80 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService", | 118 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService", |
81 BLUETOOTHLOWENERGY_GETSERVICE); | 119 BLUETOOTHLOWENERGY_GETSERVICE); |
82 | 120 |
83 protected: | 121 protected: |
84 virtual ~BluetoothLowEnergyGetServiceFunction() {} | 122 virtual ~BluetoothLowEnergyGetServiceFunction() {} |
85 | 123 |
86 // BluetoothLowEnergyExtensionFunction override. | 124 // BluetoothLowEnergyExtensionFunction override. |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); | 288 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); |
251 | 289 |
252 // The instance ID of the requested descriptor. | 290 // The instance ID of the requested descriptor. |
253 std::string instance_id_; | 291 std::string instance_id_; |
254 }; | 292 }; |
255 | 293 |
256 } // namespace api | 294 } // namespace api |
257 } // namespace extensions | 295 } // namespace extensions |
258 | 296 |
259 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_API_H_ | 297 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER
GY_API_H_ |
OLD | NEW |