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 "chrome/browser/extensions/api/bluetooth/bluetooth_socket_event_dispatc
her.h" | 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_socket_event_dispatc
her.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_socket.h" | 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_socket.h" |
9 #include "chrome/common/extensions/api/bluetooth.h" | 9 #include "chrome/common/extensions/api/bluetooth.h" |
10 #include "extensions/browser/event_router.h" | 10 #include "extensions/browser/event_router.h" |
11 #include "extensions/browser/extension_system.h" | |
12 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
13 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 namespace bluetooth = extensions::api::bluetooth; | 16 namespace bluetooth = extensions::api::bluetooth; |
18 using extensions::BluetoothApiSocket; | 17 using extensions::BluetoothApiSocket; |
19 | 18 |
20 int kDefaultBufferSize = 4096; | 19 int kDefaultBufferSize = 4096; |
21 | 20 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 void BluetoothSocketEventDispatcher::DispatchEvent( | 162 void BluetoothSocketEventDispatcher::DispatchEvent( |
164 const std::string& extension_id, | 163 const std::string& extension_id, |
165 scoped_ptr<Event> event) { | 164 scoped_ptr<Event> event) { |
166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
167 | 166 |
168 content::BrowserContext* context = | 167 content::BrowserContext* context = |
169 reinterpret_cast<content::BrowserContext*>(browser_context_id_); | 168 reinterpret_cast<content::BrowserContext*>(browser_context_id_); |
170 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) | 169 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) |
171 return; | 170 return; |
172 | 171 |
173 EventRouter* router = ExtensionSystem::Get(context)->event_router(); | 172 EventRouter* router = EventRouter::Get(context); |
174 if (router) | 173 if (router) |
175 router->DispatchEventToExtension(extension_id, event.Pass()); | 174 router->DispatchEventToExtension(extension_id, event.Pass()); |
176 } | 175 } |
177 | 176 |
178 } // namespace api | 177 } // namespace api |
179 } // namespace extensions | 178 } // namespace extensions |
OLD | NEW |