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

Unified Diff: device/bluetooth/bluetooth_profile_win.h

Issue 236203018: win: Implement Bluetooth server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_profile.cc ('k') | device/bluetooth/bluetooth_profile_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_profile_win.h
diff --git a/device/bluetooth/bluetooth_profile_win.h b/device/bluetooth/bluetooth_profile_win.h
index e235bd2ea6f0ed7b93b28cd906a572d18e66ec07..5ae66dad4f012b1b31208706b293437220f9e89c 100644
--- a/device/bluetooth/bluetooth_profile_win.h
+++ b/device/bluetooth/bluetooth_profile_win.h
@@ -7,23 +7,39 @@
#include <string>
+#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "device/bluetooth/bluetooth_profile.h"
#include "device/bluetooth/bluetooth_uuid.h"
#include "net/base/net_log.h"
+#include "net/socket/tcp_socket.h"
+
+namespace net {
+class IPEndPoint;
+}
namespace device {
+class BluetoothAdapter;
+class BluetoothAdapterWin;
class BluetoothDeviceWin;
class BluetoothSocketThreadWin;
+class BluetoothSocketWin;
class BluetoothProfileWin : public BluetoothProfile {
public:
+ typedef base::Callback<void(const std::string&)> ErrorCallback;
+
// BluetoothProfile override.
virtual void Unregister() OVERRIDE;
virtual void SetConnectionCallback(
const ConnectionCallback& callback) OVERRIDE;
- typedef base::Callback<void(const std::string&)> ErrorCallback;
+ // Called by BluetoothProfile::Register to initialize the profile object
+ // asynchronously.
+ void Init(const BluetoothUUID& uuid,
+ const device::BluetoothProfile::Options& options,
+ const ProfileCallback& callback);
void Connect(const BluetoothDeviceWin* device,
scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
@@ -36,13 +52,33 @@ class BluetoothProfileWin : public BluetoothProfile {
private:
friend BluetoothProfile;
- BluetoothProfileWin(const BluetoothUUID& uuid, const std::string& name);
+ BluetoothProfileWin();
virtual ~BluetoothProfileWin();
- const BluetoothUUID uuid_;
- const std::string name_;
+ // Internal method run to get the adapter object during initialization.
+ void OnGetAdapter(const ProfileCallback& callback,
+ scoped_refptr<BluetoothAdapter> adapter);
+
+ // Callbacks for |profile_socket_|'s StartService call.
+ void OnRegisterProfileSuccess(const ProfileCallback& callback);
+ void OnRegisterProfileError(const ProfileCallback& callback,
+ const std::string& error_message);
+
+ // Callback when |profile_socket_| accepts a connection.
+ void OnNewConnection(scoped_refptr<BluetoothSocketWin> connected,
+ const net::IPEndPoint& peer_address);
+
+ BluetoothAdapterWin* adapter() const;
+
+ BluetoothUUID uuid_;
+ std::string name_;
+ int rfcomm_channel_;
ConnectionCallback connection_callback_;
+ scoped_refptr<BluetoothAdapter> adapter_;
+ scoped_refptr<BluetoothSocketWin> profile_socket_;
+ base::WeakPtrFactory<BluetoothProfileWin> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BluetoothProfileWin);
};
« 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