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

Side by Side Diff: components/copresence_sockets/mediums/bluetooth/copresence_socket_bluetooth.h

Issue 610633002: Prototype for copresenceSockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
Ken Rockot(use gerrit already) 2014/09/30 17:26:04 nit: "media" or "transports" instead of "mediums"?
rkc 2014/10/01 19:08:23 Done.
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 COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_BLUETOOTH_H_
6 #define COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_BLUETOOTH_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "components/copresence_sockets/public/copresence_socket.h"
14 #include "device/bluetooth/bluetooth_socket.h"
15
16 namespace net {
17 class IOBuffer;
18 }
19
20 namespace copresence_sockets {
21
22 // A CopresenceSocketBluetooth is the Bluetooth implementation of a
23 // CopresenceSocket. This is currently a thin wrapper around BluetoothSocket.
24 class CopresenceSocketBluetooth
25 : public CopresenceSocket,
26 public base::SupportsWeakPtr<CopresenceSocketBluetooth> {
Cait (Slow) 2014/09/30 17:56:01 Use WeakPtrFactory here instead, too?
armansito 2014/09/30 20:37:58 Agreed, unless weak pointers to this class are nee
rkc 2014/10/01 19:08:23 Done.
rkc 2014/10/01 19:08:23 Done.
27 public:
28 CopresenceSocketBluetooth(scoped_refptr<device::BluetoothSocket> socket);
29 virtual ~CopresenceSocketBluetooth();
30
31 // CopresenceSocket overrides:
32 virtual bool Send(const std::string& data) override;
33 virtual void Receive(ReceiveCallback callback) override;
34
35 private:
36 void OnSendComplete(int status);
37 void OnSendError(const std::string& message);
38
39 void OnReceive(int size, scoped_refptr<net::IOBuffer> io_buffer);
40 void OnReceiveError(device::BluetoothSocket::ErrorReason reason,
41 const std::string& message);
42
43 scoped_refptr<device::BluetoothSocket> socket_;
44 ReceiveCallback receive_callback_;
45
46 DISALLOW_COPY_AND_ASSIGN(CopresenceSocketBluetooth);
47 };
48
49 } // namespace copresence_sockets
50
51 #endif // COMPONENTS_COPRESENCE_SOCKETS_COPRESENCE_SOCKET_BLUETOOTH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698