OLD | NEW |
---|---|
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_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ | 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include "base/memory/ref_counted.h" |
9 | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" | |
12 | 9 |
13 namespace chromeos { | 10 namespace chromeos { |
14 | 11 |
15 class BluetoothDevice; | |
16 | |
17 // The BluetoothSocket class represents a socket to a specific service on | 12 // The BluetoothSocket class represents a socket to a specific service on |
18 // a BluetoothDevice. BluetoothSocket objects are ref counted and may outlive | 13 // a BluetoothDevice. BluetoothSocket objects are ref counted and may |
19 // both the BluetoothDevice and BluetoothAdapter that were involved in their | 14 // outlive both the BluetoothDevice and BluetoothAdapter that were involved in |
20 // creation. | 15 // their creation. |
21 class BluetoothSocket : public base::RefCounted<BluetoothSocket> { | 16 class BluetoothSocket : public base::RefCounted<BluetoothSocket> { |
22 public: | 17 public: |
23 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( | 18 virtual int fd() const = 0; |
bryeung
2012/09/13 19:52:57
please at least leave a TODO that this will be rep
youngki
2012/09/17 21:53:02
Done.
| |
24 const BluetoothServiceRecord& service_record); | |
25 | 19 |
26 int fd() const { return fd_; } | 20 protected: |
27 | |
28 private: | |
29 friend class base::RefCounted<BluetoothSocket>; | 21 friend class base::RefCounted<BluetoothSocket>; |
30 | 22 virtual ~BluetoothSocket() {} |
31 BluetoothSocket(const std::string& address, int fd); | |
32 virtual ~BluetoothSocket(); | |
33 | |
34 const std::string address_; | |
35 const int fd_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(BluetoothSocket); | |
38 }; | 23 }; |
39 | 24 |
40 } // namespace chromeos | 25 } // namespace chromeos |
41 | 26 |
42 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ | 27 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
OLD | NEW |