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

Side by Side Diff: chrome/browser/extensions/api/bluetooth/bluetooth_api.h

Issue 257333002: Drive extension functions from ExtensionFunction::Run. The (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 6 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BLUETOOTH_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 public: 135 public:
136 DECLARE_EXTENSION_FUNCTION("bluetooth.getDevice", BLUETOOTH_GETDEVICE) 136 DECLARE_EXTENSION_FUNCTION("bluetooth.getDevice", BLUETOOTH_GETDEVICE)
137 137
138 // BluetoothExtensionFunction: 138 // BluetoothExtensionFunction:
139 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE; 139 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE;
140 140
141 protected: 141 protected:
142 virtual ~BluetoothGetDeviceFunction(); 142 virtual ~BluetoothGetDeviceFunction();
143 }; 143 };
144 144
145 class BluetoothAddProfileFunction : public UIThreadExtensionFunction { 145 class BluetoothAddProfileFunction : public AsyncExtensionFunction {
146 public: 146 public:
147 DECLARE_EXTENSION_FUNCTION("bluetooth.addProfile", BLUETOOTH_ADDPROFILE) 147 DECLARE_EXTENSION_FUNCTION("bluetooth.addProfile", BLUETOOTH_ADDPROFILE)
148 148
149 BluetoothAddProfileFunction(); 149 BluetoothAddProfileFunction();
150 150
151 protected: 151 protected:
152 virtual ~BluetoothAddProfileFunction(); 152 virtual ~BluetoothAddProfileFunction();
153 virtual bool RunImpl() OVERRIDE; 153 virtual bool RunAsync() OVERRIDE;
154 154
155 virtual void RegisterProfile( 155 virtual void RegisterProfile(
156 const device::BluetoothProfile::Options& options, 156 const device::BluetoothProfile::Options& options,
157 const device::BluetoothProfile::ProfileCallback& callback); 157 const device::BluetoothProfile::ProfileCallback& callback);
158 158
159 private: 159 private:
160 void OnProfileRegistered(device::BluetoothProfile* bluetooth_profile); 160 void OnProfileRegistered(device::BluetoothProfile* bluetooth_profile);
161 161
162 device::BluetoothUUID uuid_; 162 device::BluetoothUUID uuid_;
163 }; 163 };
(...skipping 16 matching lines...) Expand all
180 virtual ~BluetoothConnectFunction(); 180 virtual ~BluetoothConnectFunction();
181 181
182 // BluetoothExtensionFunction: 182 // BluetoothExtensionFunction:
183 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE; 183 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE;
184 184
185 private: 185 private:
186 void OnSuccessCallback(); 186 void OnSuccessCallback();
187 void OnErrorCallback(const std::string& error); 187 void OnErrorCallback(const std::string& error);
188 }; 188 };
189 189
190 class BluetoothDisconnectFunction : public UIThreadExtensionFunction { 190 class BluetoothDisconnectFunction : public AsyncExtensionFunction {
191 public: 191 public:
192 DECLARE_EXTENSION_FUNCTION("bluetooth.disconnect", BLUETOOTH_DISCONNECT) 192 DECLARE_EXTENSION_FUNCTION("bluetooth.disconnect", BLUETOOTH_DISCONNECT)
193 193
194 protected: 194 protected:
195 virtual ~BluetoothDisconnectFunction() {} 195 virtual ~BluetoothDisconnectFunction() {}
196 196
197 // UIThreadExtensionFunction: 197 // AsyncExtensionFunction:
198 virtual bool RunImpl() OVERRIDE; 198 virtual bool RunAsync() OVERRIDE;
199 }; 199 };
200 200
201 class BluetoothSendFunction : public UIThreadExtensionFunction { 201 class BluetoothSendFunction : public AsyncExtensionFunction {
202 public: 202 public:
203 DECLARE_EXTENSION_FUNCTION("bluetooth.send", BLUETOOTH_WRITE) 203 DECLARE_EXTENSION_FUNCTION("bluetooth.send", BLUETOOTH_WRITE)
204 204
205 protected: 205 protected:
206 virtual ~BluetoothSendFunction() {} 206 virtual ~BluetoothSendFunction() {}
207 207
208 // UIThreadExtensionFunction: 208 // AsyncExtensionFunction:
209 virtual bool RunImpl() OVERRIDE; 209 virtual bool RunAsync() OVERRIDE;
210 }; 210 };
211 211
212 class BluetoothUpdateSocketFunction : public UIThreadExtensionFunction { 212 class BluetoothUpdateSocketFunction : public AsyncExtensionFunction {
213 public: 213 public:
214 DECLARE_EXTENSION_FUNCTION("bluetooth.updateSocket", BLUETOOTH_UPDATE_SOCKET) 214 DECLARE_EXTENSION_FUNCTION("bluetooth.updateSocket", BLUETOOTH_UPDATE_SOCKET)
215 215
216 protected: 216 protected:
217 virtual ~BluetoothUpdateSocketFunction() {} 217 virtual ~BluetoothUpdateSocketFunction() {}
218 218
219 // UIThreadExtensionFunction: 219 // AsyncExtensionFunction:
220 virtual bool RunImpl() OVERRIDE; 220 virtual bool RunAsync() OVERRIDE;
221 }; 221 };
222 222
223 class BluetoothSetSocketPausedFunction : public UIThreadExtensionFunction { 223 class BluetoothSetSocketPausedFunction : public AsyncExtensionFunction {
224 public: 224 public:
225 DECLARE_EXTENSION_FUNCTION("bluetooth.setSocketPaused", 225 DECLARE_EXTENSION_FUNCTION("bluetooth.setSocketPaused",
226 BLUETOOTH_SET_SOCKET_PAUSED) 226 BLUETOOTH_SET_SOCKET_PAUSED)
227 227
228 protected: 228 protected:
229 virtual ~BluetoothSetSocketPausedFunction() {} 229 virtual ~BluetoothSetSocketPausedFunction() {}
230 230
231 // UIThreadExtensionFunction: 231 // AsyncExtensionFunction:
232 virtual bool RunImpl() OVERRIDE; 232 virtual bool RunAsync() OVERRIDE;
233 }; 233 };
234 234
235 class BluetoothGetSocketFunction : public UIThreadExtensionFunction { 235 class BluetoothGetSocketFunction : public AsyncExtensionFunction {
236 public: 236 public:
237 DECLARE_EXTENSION_FUNCTION("bluetooth.getSocket", BLUETOOTH_GET_SOCKET) 237 DECLARE_EXTENSION_FUNCTION("bluetooth.getSocket", BLUETOOTH_GET_SOCKET)
238 238
239 protected: 239 protected:
240 virtual ~BluetoothGetSocketFunction() {} 240 virtual ~BluetoothGetSocketFunction() {}
241 241
242 // UIThreadExtensionFunction: 242 // AsyncExtensionFunction:
243 virtual bool RunImpl() OVERRIDE; 243 virtual bool RunAsync() OVERRIDE;
244 }; 244 };
245 245
246 class BluetoothGetSocketsFunction : public UIThreadExtensionFunction { 246 class BluetoothGetSocketsFunction : public AsyncExtensionFunction {
247 public: 247 public:
248 DECLARE_EXTENSION_FUNCTION("bluetooth.getSockets", BLUETOOTH_GET_SOCKETS) 248 DECLARE_EXTENSION_FUNCTION("bluetooth.getSockets", BLUETOOTH_GET_SOCKETS)
249 249
250 protected: 250 protected:
251 virtual ~BluetoothGetSocketsFunction() {} 251 virtual ~BluetoothGetSocketsFunction() {}
252 252
253 // UIThreadExtensionFunction: 253 // AsyncExtensionFunction:
254 virtual bool RunImpl() OVERRIDE; 254 virtual bool RunAsync() OVERRIDE;
255 }; 255 };
256 256
257 class BluetoothGetLocalOutOfBandPairingDataFunction 257 class BluetoothGetLocalOutOfBandPairingDataFunction
258 : public BluetoothExtensionFunction { 258 : public BluetoothExtensionFunction {
259 public: 259 public:
260 DECLARE_EXTENSION_FUNCTION("bluetooth.getLocalOutOfBandPairingData", 260 DECLARE_EXTENSION_FUNCTION("bluetooth.getLocalOutOfBandPairingData",
261 BLUETOOTH_GETLOCALOUTOFBANDPAIRINGDATA) 261 BLUETOOTH_GETLOCALOUTOFBANDPAIRINGDATA)
262 262
263 protected: 263 protected:
264 virtual ~BluetoothGetLocalOutOfBandPairingDataFunction() {} 264 virtual ~BluetoothGetLocalOutOfBandPairingDataFunction() {}
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 private: 315 private:
316 void OnSuccessCallback(); 316 void OnSuccessCallback();
317 void OnErrorCallback(); 317 void OnErrorCallback();
318 }; 318 };
319 319
320 } // namespace api 320 } // namespace api
321 } // namespace extensions 321 } // namespace extensions
322 322
323 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 323 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698