| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 enum SocketType { kRfcomm, kL2cap }; | 63 enum SocketType { kRfcomm, kL2cap }; |
| 64 virtual void Listen( | 64 virtual void Listen( |
| 65 scoped_refptr<device::BluetoothAdapter> adapter, | 65 scoped_refptr<device::BluetoothAdapter> adapter, |
| 66 SocketType socket_type, | 66 SocketType socket_type, |
| 67 const device::BluetoothUUID& uuid, | 67 const device::BluetoothUUID& uuid, |
| 68 const device::BluetoothAdapter::ServiceOptions& service_options, | 68 const device::BluetoothAdapter::ServiceOptions& service_options, |
| 69 const base::Closure& success_callback, | 69 const base::Closure& success_callback, |
| 70 const ErrorCompletionCallback& error_callback); | 70 const ErrorCompletionCallback& error_callback); |
| 71 | 71 |
| 72 // BluetoothSocket: | 72 // BluetoothSocket: |
| 73 virtual void Close() OVERRIDE; | 73 virtual void Close() override; |
| 74 virtual void Disconnect(const base::Closure& callback) OVERRIDE; | 74 virtual void Disconnect(const base::Closure& callback) override; |
| 75 virtual void Accept(const AcceptCompletionCallback& success_callback, | 75 virtual void Accept(const AcceptCompletionCallback& success_callback, |
| 76 const ErrorCompletionCallback& error_callback) OVERRIDE; | 76 const ErrorCompletionCallback& error_callback) override; |
| 77 | 77 |
| 78 // Returns the object path of the socket. | 78 // Returns the object path of the socket. |
| 79 const dbus::ObjectPath& object_path() const { return object_path_; } | 79 const dbus::ObjectPath& object_path() const { return object_path_; } |
| 80 | 80 |
| 81 protected: | 81 protected: |
| 82 virtual ~BluetoothSocketChromeOS(); | 82 virtual ~BluetoothSocketChromeOS(); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 BluetoothSocketChromeOS( | 85 BluetoothSocketChromeOS( |
| 86 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 86 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
| 87 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 87 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
| 88 | 88 |
| 89 // Register the underlying profile client object with the Bluetooth Daemon. | 89 // Register the underlying profile client object with the Bluetooth Daemon. |
| 90 void RegisterProfile(const base::Closure& success_callback, | 90 void RegisterProfile(const base::Closure& success_callback, |
| 91 const ErrorCompletionCallback& error_callback); | 91 const ErrorCompletionCallback& error_callback); |
| 92 void OnRegisterProfile(const base::Closure& success_callback, | 92 void OnRegisterProfile(const base::Closure& success_callback, |
| 93 const ErrorCompletionCallback& error_callback); | 93 const ErrorCompletionCallback& error_callback); |
| 94 void OnRegisterProfileError(const ErrorCompletionCallback& error_callback, | 94 void OnRegisterProfileError(const ErrorCompletionCallback& error_callback, |
| 95 const std::string& error_name, | 95 const std::string& error_name, |
| 96 const std::string& error_message); | 96 const std::string& error_message); |
| 97 | 97 |
| 98 // Called by dbus:: on completion of the ConnectProfile() method. | 98 // Called by dbus:: on completion of the ConnectProfile() method. |
| 99 void OnConnectProfile(const base::Closure& success_callback); | 99 void OnConnectProfile(const base::Closure& success_callback); |
| 100 void OnConnectProfileError(const ErrorCompletionCallback& error_callback, | 100 void OnConnectProfileError(const ErrorCompletionCallback& error_callback, |
| 101 const std::string& error_name, | 101 const std::string& error_name, |
| 102 const std::string& error_message); | 102 const std::string& error_message); |
| 103 | 103 |
| 104 // BluetoothAdapter::Observer: | 104 // BluetoothAdapter::Observer: |
| 105 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, | 105 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, |
| 106 bool present) OVERRIDE; | 106 bool present) override; |
| 107 | 107 |
| 108 // Called by dbus:: on completion of the RegisterProfile() method call | 108 // Called by dbus:: on completion of the RegisterProfile() method call |
| 109 // triggered as a result of the adapter becoming present again. | 109 // triggered as a result of the adapter becoming present again. |
| 110 void OnInternalRegisterProfile(); | 110 void OnInternalRegisterProfile(); |
| 111 void OnInternalRegisterProfileError(const std::string& error_name, | 111 void OnInternalRegisterProfileError(const std::string& error_name, |
| 112 const std::string& error_message); | 112 const std::string& error_message); |
| 113 | 113 |
| 114 // BluetoothProfileServiceProvider::Delegate: | 114 // BluetoothProfileServiceProvider::Delegate: |
| 115 virtual void Released() OVERRIDE; | 115 virtual void Released() override; |
| 116 virtual void NewConnection( | 116 virtual void NewConnection( |
| 117 const dbus::ObjectPath& device_path, | 117 const dbus::ObjectPath& device_path, |
| 118 scoped_ptr<dbus::FileDescriptor> fd, | 118 scoped_ptr<dbus::FileDescriptor> fd, |
| 119 const BluetoothProfileServiceProvider::Delegate::Options& options, | 119 const BluetoothProfileServiceProvider::Delegate::Options& options, |
| 120 const ConfirmationCallback& callback) OVERRIDE; | 120 const ConfirmationCallback& callback) override; |
| 121 virtual void RequestDisconnection( | 121 virtual void RequestDisconnection( |
| 122 const dbus::ObjectPath& device_path, | 122 const dbus::ObjectPath& device_path, |
| 123 const ConfirmationCallback& callback) OVERRIDE; | 123 const ConfirmationCallback& callback) override; |
| 124 virtual void Cancel() OVERRIDE; | 124 virtual void Cancel() override; |
| 125 | 125 |
| 126 // Method run to accept a single incoming connection. | 126 // Method run to accept a single incoming connection. |
| 127 void AcceptConnectionRequest(); | 127 void AcceptConnectionRequest(); |
| 128 | 128 |
| 129 // Method run on the socket thread to validate the file descriptor of a new | 129 // Method run on the socket thread to validate the file descriptor of a new |
| 130 // connection and set up the underlying net::TCPSocket() for it. | 130 // connection and set up the underlying net::TCPSocket() for it. |
| 131 void DoNewConnection( | 131 void DoNewConnection( |
| 132 const dbus::ObjectPath& device_path, | 132 const dbus::ObjectPath& device_path, |
| 133 scoped_ptr<dbus::FileDescriptor> fd, | 133 scoped_ptr<dbus::FileDescriptor> fd, |
| 134 const BluetoothProfileServiceProvider::Delegate::Options& options, | 134 const BluetoothProfileServiceProvider::Delegate::Options& options, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 bool cancelled; | 202 bool cancelled; |
| 203 }; | 203 }; |
| 204 std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_; | 204 std::queue<linked_ptr<ConnectionRequest> > connection_request_queue_; |
| 205 | 205 |
| 206 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); | 206 DISALLOW_COPY_AND_ASSIGN(BluetoothSocketChromeOS); |
| 207 }; | 207 }; |
| 208 | 208 |
| 209 } // namespace chromeos | 209 } // namespace chromeos |
| 210 | 210 |
| 211 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ | 211 #endif // DEVICE_BLUETOOTH_BLUETOOTH_SOCKET_CHROMEOS_H_ |
| OLD | NEW |