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 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" | 5 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "device/bluetooth/bluetooth_socket.h" | 8 #include "device/bluetooth/bluetooth_socket.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const char kSocketNotConnectedError[] = "Socket not connected"; | 13 const char kSocketNotConnectedError[] = "Socket not connected"; |
14 const char kSocketNotListeningError[] = "Socket not listening"; | 14 const char kSocketNotListeningError[] = "Socket not listening"; |
15 | 15 |
16 } // namespace | 16 } // namespace |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 // static | 20 // static |
21 static base::LazyInstance< | 21 static base::LazyInstance<BrowserContextKeyedAPIFactory< |
22 BrowserContextKeyedAPIFactory<ApiResourceManager<BluetoothApiSocket> > > | 22 ApiResourceManager<BluetoothApiSocket>>>::DestructorAtExit |
23 g_server_factory = LAZY_INSTANCE_INITIALIZER; | 23 g_server_factory = LAZY_INSTANCE_INITIALIZER; |
24 | 24 |
25 // static | 25 // static |
26 template <> | 26 template <> |
27 BrowserContextKeyedAPIFactory<ApiResourceManager<BluetoothApiSocket> >* | 27 BrowserContextKeyedAPIFactory<ApiResourceManager<BluetoothApiSocket> >* |
28 ApiResourceManager<BluetoothApiSocket>::GetFactoryInstance() { | 28 ApiResourceManager<BluetoothApiSocket>::GetFactoryInstance() { |
29 return g_server_factory.Pointer(); | 29 return g_server_factory.Pointer(); |
30 } | 30 } |
31 | 31 |
32 BluetoothApiSocket::BluetoothApiSocket(const std::string& owner_extension_id) | 32 BluetoothApiSocket::BluetoothApiSocket(const std::string& owner_extension_id) |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 // static | 189 // static |
190 void BluetoothApiSocket::OnSocketAcceptError( | 190 void BluetoothApiSocket::OnSocketAcceptError( |
191 const ErrorCompletionCallback& error_callback, | 191 const ErrorCompletionCallback& error_callback, |
192 const std::string& message) { | 192 const std::string& message) { |
193 DCHECK_CURRENTLY_ON(kThreadId); | 193 DCHECK_CURRENTLY_ON(kThreadId); |
194 error_callback.Run(BluetoothApiSocket::kSystemError, message); | 194 error_callback.Run(BluetoothApiSocket::kSystemError, message); |
195 } | 195 } |
196 | 196 |
197 } // namespace extensions | 197 } // namespace extensions |
OLD | NEW |