Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h

Issue 349433002: chrome.bluetoothLowEnergy: Introduce connect and disconnect methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 // Callback called by BluetoothLowEnergyEventRouter::Disconnect when the
110 // operation has completed.
111 void SuccessCallback();
112 };
113
77 class BluetoothLowEnergyGetServiceFunction 114 class BluetoothLowEnergyGetServiceFunction
78 : public BluetoothLowEnergyExtensionFunction { 115 : public BluetoothLowEnergyExtensionFunction {
79 public: 116 public:
80 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService", 117 DECLARE_EXTENSION_FUNCTION("bluetoothLowEnergy.getService",
81 BLUETOOTHLOWENERGY_GETSERVICE); 118 BLUETOOTHLOWENERGY_GETSERVICE);
82 119
83 protected: 120 protected:
84 virtual ~BluetoothLowEnergyGetServiceFunction() {} 121 virtual ~BluetoothLowEnergyGetServiceFunction() {}
85 122
86 // BluetoothLowEnergyExtensionFunction override. 123 // BluetoothLowEnergyExtensionFunction override.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status); 287 void ErrorCallback(BluetoothLowEnergyEventRouter::Status status);
251 288
252 // The instance ID of the requested descriptor. 289 // The instance ID of the requested descriptor.
253 std::string instance_id_; 290 std::string instance_id_;
254 }; 291 };
255 292
256 } // namespace api 293 } // namespace api
257 } // namespace extensions 294 } // namespace extensions
258 295
259 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER GY_API_H_ 296 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_LOW_ENERGY_BLUETOOTH_LOW_ENER GY_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698