OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ |
6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 scoped_refptr<device::BluetoothSocket>)> | 34 scoped_refptr<device::BluetoothSocket>)> |
35 AcceptCompletionCallback; | 35 AcceptCompletionCallback; |
36 typedef base::Callback<void(ErrorReason, const std::string& error_message)> | 36 typedef base::Callback<void(ErrorReason, const std::string& error_message)> |
37 ErrorCompletionCallback; | 37 ErrorCompletionCallback; |
38 | 38 |
39 explicit BluetoothApiSocket(const std::string& owner_extension_id); | 39 explicit BluetoothApiSocket(const std::string& owner_extension_id); |
40 BluetoothApiSocket(const std::string& owner_extension_id, | 40 BluetoothApiSocket(const std::string& owner_extension_id, |
41 scoped_refptr<device::BluetoothSocket> socket, | 41 scoped_refptr<device::BluetoothSocket> socket, |
42 const std::string& device_address, | 42 const std::string& device_address, |
43 const device::BluetoothUUID& uuid); | 43 const device::BluetoothUUID& uuid); |
44 virtual ~BluetoothApiSocket(); | 44 ~BluetoothApiSocket() override; |
45 | 45 |
46 // Adopts a socket |socket| connected to a device with address | 46 // Adopts a socket |socket| connected to a device with address |
47 // |device_address| using the service with UUID |uuid|. | 47 // |device_address| using the service with UUID |uuid|. |
48 virtual void AdoptConnectedSocket( | 48 virtual void AdoptConnectedSocket( |
49 scoped_refptr<device::BluetoothSocket> socket, | 49 scoped_refptr<device::BluetoothSocket> socket, |
50 const std::string& device_address, | 50 const std::string& device_address, |
51 const device::BluetoothUUID& uuid); | 51 const device::BluetoothUUID& uuid); |
52 | 52 |
53 // Adopts a socket |socket| listening on a service advertised with UUID | 53 // Adopts a socket |socket| listening on a service advertised with UUID |
54 // |uuid|. | 54 // |uuid|. |
(...skipping 27 matching lines...) Expand all Loading... |
82 // Accepts a client connection from the socket and calls |success_callback| | 82 // Accepts a client connection from the socket and calls |success_callback| |
83 // when one has connected. If an error occurs, calls |error_callback| with a | 83 // when one has connected. If an error occurs, calls |error_callback| with a |
84 // reason and a message. | 84 // reason and a message. |
85 virtual void Accept(const AcceptCompletionCallback& success_callback, | 85 virtual void Accept(const AcceptCompletionCallback& success_callback, |
86 const ErrorCompletionCallback& error_callback); | 86 const ErrorCompletionCallback& error_callback); |
87 | 87 |
88 const std::string& device_address() const { return device_address_; } | 88 const std::string& device_address() const { return device_address_; } |
89 const device::BluetoothUUID& uuid() const { return uuid_; } | 89 const device::BluetoothUUID& uuid() const { return uuid_; } |
90 | 90 |
91 // Overriden from extensions::ApiResource. | 91 // Overriden from extensions::ApiResource. |
92 virtual bool IsPersistent() const override; | 92 bool IsPersistent() const override; |
93 | 93 |
94 const std::string* name() const { return name_.get(); } | 94 const std::string* name() const { return name_.get(); } |
95 void set_name(const std::string& name) { name_.reset(new std::string(name)); } | 95 void set_name(const std::string& name) { name_.reset(new std::string(name)); } |
96 | 96 |
97 bool persistent() const { return persistent_; } | 97 bool persistent() const { return persistent_; } |
98 void set_persistent(bool persistent) { persistent_ = persistent; } | 98 void set_persistent(bool persistent) { persistent_ = persistent; } |
99 | 99 |
100 int buffer_size() const { return buffer_size_; } | 100 int buffer_size() const { return buffer_size_; } |
101 void set_buffer_size(int buffer_size) { buffer_size_ = buffer_size; } | 101 void set_buffer_size(int buffer_size) { buffer_size_ = buffer_size; } |
102 | 102 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 // Flag indicating whether a socket is connected. | 153 // Flag indicating whether a socket is connected. |
154 bool connected_; | 154 bool connected_; |
155 | 155 |
156 DISALLOW_COPY_AND_ASSIGN(BluetoothApiSocket); | 156 DISALLOW_COPY_AND_ASSIGN(BluetoothApiSocket); |
157 }; | 157 }; |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
160 | 160 |
161 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ | 161 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_API_SOCKET_H_ |
OLD | NEW |