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

Side by Side Diff: device/bluetooth/bluetooth_profile_win.h

Issue 320463002: Bluetooth: Implement socket API for Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DeviceWin return SDRWin to avoid cast 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
« no previous file with comments | « device/bluetooth/bluetooth_profile.cc ('k') | device/bluetooth/bluetooth_profile_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_WIN_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_WIN_H_
7
8 #include <string>
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "device/bluetooth/bluetooth_profile.h"
13 #include "device/bluetooth/bluetooth_uuid.h"
14 #include "net/base/net_log.h"
15 #include "net/socket/tcp_socket.h"
16
17 namespace net {
18 class IPEndPoint;
19 }
20
21 namespace device {
22
23 class BluetoothAdapter;
24 class BluetoothAdapterWin;
25 class BluetoothDeviceWin;
26 class BluetoothSocketThread;
27 class BluetoothSocketWin;
28
29 class BluetoothProfileWin : public BluetoothProfile {
30 public:
31 typedef base::Callback<void(const std::string&)> ErrorCallback;
32
33 // BluetoothProfile override.
34 virtual void Unregister() OVERRIDE;
35 virtual void SetConnectionCallback(
36 const ConnectionCallback& callback) OVERRIDE;
37
38 // Called by BluetoothProfile::Register to initialize the profile object
39 // asynchronously.
40 void Init(const BluetoothUUID& uuid,
41 const device::BluetoothProfile::Options& options,
42 const ProfileCallback& callback);
43
44 void Connect(const BluetoothDeviceWin* device,
45 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
46 scoped_refptr<BluetoothSocketThread> socket_thread,
47 net::NetLog* net_log,
48 const net::NetLog::Source& source,
49 const base::Closure& callback,
50 const ErrorCallback& error_callback);
51
52 private:
53 friend BluetoothProfile;
54
55 BluetoothProfileWin();
56 virtual ~BluetoothProfileWin();
57
58 // Internal method run to get the adapter object during initialization.
59 void OnGetAdapter(const ProfileCallback& callback,
60 scoped_refptr<BluetoothAdapter> adapter);
61
62 // Callbacks for |profile_socket_|'s StartService call.
63 void OnRegisterProfileSuccess(const ProfileCallback& callback);
64 void OnRegisterProfileError(const ProfileCallback& callback,
65 const std::string& error_message);
66
67 // Callback when |profile_socket_| accepts a connection.
68 void OnNewConnection(scoped_refptr<BluetoothSocketWin> connected,
69 const net::IPEndPoint& peer_address);
70
71 BluetoothAdapterWin* adapter() const;
72
73 BluetoothUUID uuid_;
74 std::string name_;
75 int rfcomm_channel_;
76 ConnectionCallback connection_callback_;
77
78 scoped_refptr<BluetoothAdapter> adapter_;
79 scoped_refptr<BluetoothSocketWin> profile_socket_;
80 base::WeakPtrFactory<BluetoothProfileWin> weak_ptr_factory_;
81
82 DISALLOW_COPY_AND_ASSIGN(BluetoothProfileWin);
83 };
84
85 } // namespace device
86
87 #endif // DEVICE_BLUETOOTH_BLUETOOTH_PROFILE_WIN_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_profile.cc ('k') | device/bluetooth/bluetooth_profile_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698