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

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: appshell 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 scoped_refptr<SocketData> socket_data_; 107 scoped_refptr<SocketData> socket_data_;
108 scoped_refptr<api::BluetoothSocketEventDispatcher> socket_event_dispatcher_; 108 scoped_refptr<api::BluetoothSocketEventDispatcher> socket_event_dispatcher_;
109 }; 109 };
110 110
111 namespace api { 111 namespace api {
112 112
113 class BluetoothSocketEventDispatcher; 113 class BluetoothSocketEventDispatcher;
114 114
115 // Base class for methods dealing with BluetoothSocketApi and 115 // Base class for methods dealing with BluetoothSocketApi and
116 // ApiResourceManager<BluetoothSocketApi>. 116 // ApiResourceManager<BluetoothSocketApi>.
117 class BluetoothSocketApiFunction : public UIThreadExtensionFunction { 117 class BluetoothSocketApiFunction : public AsyncExtensionFunction {
118 public: 118 public:
119 BluetoothSocketApiFunction(); 119 BluetoothSocketApiFunction();
120 120
121 protected: 121 protected:
122 virtual ~BluetoothSocketApiFunction(); 122 virtual ~BluetoothSocketApiFunction();
123 123
124 // ExtensionFunction::RunImpl() 124 // ExtensionFunction::RunAsync()
125 virtual bool RunImpl() OVERRIDE; 125 virtual bool RunAsync() OVERRIDE;
126 126
127 bool PrePrepare(); 127 bool PrePrepare();
128 bool Respond(); 128 bool Respond();
129 void AsyncWorkCompleted(); 129 void AsyncWorkCompleted();
130 130
131 virtual bool Prepare() = 0; 131 virtual bool Prepare() = 0;
132 virtual void Work(); 132 virtual void Work();
133 virtual void AsyncWorkStart(); 133 virtual void AsyncWorkStart();
134 134
135 content::BrowserThread::ID work_thread_id() const { 135 content::BrowserThread::ID work_thread_id() const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 public: 167 public:
168 DECLARE_EXTENSION_FUNCTION("bluetooth.getDevice", BLUETOOTH_GETDEVICE) 168 DECLARE_EXTENSION_FUNCTION("bluetooth.getDevice", BLUETOOTH_GETDEVICE)
169 169
170 // BluetoothExtensionFunction: 170 // BluetoothExtensionFunction:
171 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE; 171 virtual bool DoWork(scoped_refptr<device::BluetoothAdapter> adapter) OVERRIDE;
172 172
173 protected: 173 protected:
174 virtual ~BluetoothGetDeviceFunction(); 174 virtual ~BluetoothGetDeviceFunction();
175 }; 175 };
176 176
177 class BluetoothAddProfileFunction : public UIThreadExtensionFunction { 177 class BluetoothAddProfileFunction : public AsyncExtensionFunction {
178 public: 178 public:
179 DECLARE_EXTENSION_FUNCTION("bluetooth.addProfile", BLUETOOTH_ADDPROFILE) 179 DECLARE_EXTENSION_FUNCTION("bluetooth.addProfile", BLUETOOTH_ADDPROFILE)
180 180
181 BluetoothAddProfileFunction(); 181 BluetoothAddProfileFunction();
182 182
183 protected: 183 protected:
184 virtual ~BluetoothAddProfileFunction(); 184 virtual ~BluetoothAddProfileFunction();
185 virtual bool RunImpl() OVERRIDE; 185 virtual bool RunAsync() OVERRIDE;
186 186
187 virtual void RegisterProfile( 187 virtual void RegisterProfile(
188 const device::BluetoothProfile::Options& options, 188 const device::BluetoothProfile::Options& options,
189 const device::BluetoothProfile::ProfileCallback& callback); 189 const device::BluetoothProfile::ProfileCallback& callback);
190 190
191 private: 191 private:
192 void OnProfileRegistered(device::BluetoothProfile* bluetooth_profile); 192 void OnProfileRegistered(device::BluetoothProfile* bluetooth_profile);
193 193
194 device::BluetoothUUID uuid_; 194 device::BluetoothUUID uuid_;
195 }; 195 };
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 private: 383 private:
384 void OnSuccessCallback(); 384 void OnSuccessCallback();
385 void OnErrorCallback(); 385 void OnErrorCallback();
386 }; 386 };
387 387
388 } // namespace api 388 } // namespace api
389 } // namespace extensions 389 } // namespace extensions
390 390
391 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_ 391 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698