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

Side by Side Diff: chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h

Issue 491753002: [EasyUnlock] Add a private API for establishing an insecure Bluetooth connection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix non-ChromeOS build Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SOCKET_BLUETOOTH_SOCKET_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 error_callback) OVERRIDE; 201 error_callback) OVERRIDE;
202 virtual void CreateResults() OVERRIDE; 202 virtual void CreateResults() OVERRIDE;
203 203
204 protected: 204 protected:
205 virtual ~BluetoothSocketListenUsingL2capFunction(); 205 virtual ~BluetoothSocketListenUsingL2capFunction();
206 206
207 private: 207 private:
208 scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_; 208 scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_;
209 }; 209 };
210 210
211 class BluetoothSocketConnectFunction : public BluetoothSocketAsyncApiFunction { 211 class BluetoothSocketAbstractConnectFunction :
212 public BluetoothSocketAsyncApiFunction {
213 public:
214 BluetoothSocketAbstractConnectFunction();
215
216 protected:
217 virtual ~BluetoothSocketAbstractConnectFunction();
218
219 // BluetoothSocketAsyncApiFunction:
220 virtual bool Prepare() OVERRIDE;
221 virtual void AsyncWorkStart() OVERRIDE;
222
223 // Subclasses should implement this method to connect to the service
224 // registered with |uuid| on the |device|.
225 virtual void ConnectToService(device::BluetoothDevice* device,
226 const device::BluetoothUUID& uuid) = 0;
227
228 virtual void OnConnect(scoped_refptr<device::BluetoothSocket> socket);
229 virtual void OnConnectError(const std::string& message);
230
231 private:
232 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
233
234 scoped_ptr<bluetooth_socket::Connect::Params> params_;
235 BluetoothSocketEventDispatcher* socket_event_dispatcher_;
236 };
237
238 class BluetoothSocketConnectFunction :
239 public BluetoothSocketAbstractConnectFunction {
212 public: 240 public:
213 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect", 241 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect",
214 BLUETOOTHSOCKET_CONNECT); 242 BLUETOOTHSOCKET_CONNECT);
215 243
216 BluetoothSocketConnectFunction(); 244 BluetoothSocketConnectFunction();
217 245
218 protected: 246 protected:
219 virtual ~BluetoothSocketConnectFunction(); 247 virtual ~BluetoothSocketConnectFunction();
220 248
221 // BluetoothSocketAsyncApiFunction: 249 // BluetoothSocketAbstractConnectFunction:
222 virtual bool Prepare() OVERRIDE; 250 virtual void ConnectToService(device::BluetoothDevice* device,
223 virtual void AsyncWorkStart() OVERRIDE; 251 const device::BluetoothUUID& uuid) OVERRIDE;
224
225 private:
226 virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
227 virtual void OnConnect(scoped_refptr<device::BluetoothSocket> socket);
228 virtual void OnConnectError(const std::string& message);
229
230 scoped_ptr<bluetooth_socket::Connect::Params> params_;
231 BluetoothSocketEventDispatcher* socket_event_dispatcher_;
232 }; 252 };
233 253
234 class BluetoothSocketDisconnectFunction 254 class BluetoothSocketDisconnectFunction
235 : public BluetoothSocketAsyncApiFunction { 255 : public BluetoothSocketAsyncApiFunction {
236 public: 256 public:
237 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.disconnect", 257 DECLARE_EXTENSION_FUNCTION("bluetoothSocket.disconnect",
238 BLUETOOTHSOCKET_DISCONNECT); 258 BLUETOOTHSOCKET_DISCONNECT);
239 259
240 BluetoothSocketDisconnectFunction(); 260 BluetoothSocketDisconnectFunction();
241 261
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 343
324 // BluetoothSocketAsyncApiFunction: 344 // BluetoothSocketAsyncApiFunction:
325 virtual bool Prepare() OVERRIDE; 345 virtual bool Prepare() OVERRIDE;
326 virtual void Work() OVERRIDE; 346 virtual void Work() OVERRIDE;
327 }; 347 };
328 348
329 } // namespace api 349 } // namespace api
330 } // namespace extensions 350 } // namespace extensions
331 351
332 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H _ 352 #endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H _
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698