| 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_SOCKET_EVENT_DISPATCHE
R_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ |
| 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ | 6 #define EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPATCHE
R_H_ |
| 7 | 7 |
| 8 #include "extensions/browser/api/api_resource_manager.h" | 8 #include "extensions/browser/api/api_resource_manager.h" |
| 9 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" | 9 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
| 10 #include "extensions/browser/browser_context_keyed_api_factory.h" | 10 #include "extensions/browser/browser_context_keyed_api_factory.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 static void AcceptCallback(const SocketParams& params, | 94 static void AcceptCallback(const SocketParams& params, |
| 95 const device::BluetoothDevice* device, | 95 const device::BluetoothDevice* device, |
| 96 scoped_refptr<device::BluetoothSocket> socket); | 96 scoped_refptr<device::BluetoothSocket> socket); |
| 97 | 97 |
| 98 // Called when socket encounters an error while accepting a client connection. | 98 // Called when socket encounters an error while accepting a client connection. |
| 99 static void AcceptErrorCallback(const SocketParams& params, | 99 static void AcceptErrorCallback(const SocketParams& params, |
| 100 BluetoothApiSocket::ErrorReason error_reason, | 100 BluetoothApiSocket::ErrorReason error_reason, |
| 101 const std::string& error); | 101 const std::string& error); |
| 102 | 102 |
| 103 // Post an extension event from IO to UI thread | 103 // Post an extension event from IO to UI thread |
| 104 static void PostEvent(const SocketParams& params, scoped_ptr<Event> event); | 104 static void PostEvent(const SocketParams& params, |
| 105 std::unique_ptr<Event> event); |
| 105 | 106 |
| 106 // Dispatch an extension event on to EventRouter instance on UI thread. | 107 // Dispatch an extension event on to EventRouter instance on UI thread. |
| 107 static void DispatchEvent(void* browser_context_id, | 108 static void DispatchEvent(void* browser_context_id, |
| 108 const std::string& extension_id, | 109 const std::string& extension_id, |
| 109 scoped_ptr<Event> event); | 110 std::unique_ptr<Event> event); |
| 110 | 111 |
| 111 // Usually FILE thread (except for unit testing). | 112 // Usually FILE thread (except for unit testing). |
| 112 content::BrowserThread::ID thread_id_; | 113 content::BrowserThread::ID thread_id_; |
| 113 content::BrowserContext* const browser_context_; | 114 content::BrowserContext* const browser_context_; |
| 114 scoped_refptr<SocketData> sockets_; | 115 scoped_refptr<SocketData> sockets_; |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace api | 118 } // namespace api |
| 118 } // namespace extensions | 119 } // namespace extensions |
| 119 | 120 |
| 120 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPAT
CHER_H_ | 121 #endif // EXTENSIONS_BROWSER_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_EVENT_DISPAT
CHER_H_ |
| OLD | NEW |