OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" |
| 13 |
| 14 namespace chromeos { |
| 15 |
| 16 class BluetoothDevice; |
| 17 |
| 18 // The BluetoothSocket class represents a socket to a specific service on |
| 19 // a BluetoothDevice. BluetoothSocket objects are ref counted and may outlive |
| 20 // both the BluetoothDevice and BluetoothAdapter that were involved in their |
| 21 // creation. |
| 22 class BluetoothSocket : public base::RefCounted<BluetoothSocket> { |
| 23 public: |
| 24 static scoped_refptr<BluetoothSocket> CreateBluetoothSocket( |
| 25 const BluetoothServiceRecord& service_record); |
| 26 |
| 27 int fd() const { return fd_; } |
| 28 |
| 29 private: |
| 30 friend class base::RefCounted<BluetoothSocket>; |
| 31 |
| 32 BluetoothSocket(const std::string& address, int fd); |
| 33 virtual ~BluetoothSocket(); |
| 34 |
| 35 const std::string address_; |
| 36 const int fd_; |
| 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(BluetoothSocket); |
| 39 }; |
| 40 |
| 41 } // namespace chromeos |
| 42 |
| 43 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_SOCKET_H_ |
OLD | NEW |