| 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_socket_event_dispatc
her.h" | 5 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatc
her.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "device/bluetooth/bluetooth_device.h" | 8 #include "device/bluetooth/bluetooth_device.h" |
| 9 #include "device/bluetooth/bluetooth_socket.h" | 9 #include "device/bluetooth/bluetooth_socket.h" |
| 10 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" | 10 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 params.browser_context_id, | 348 params.browser_context_id, |
| 349 params.extension_id, | 349 params.extension_id, |
| 350 base::Passed(event.Pass()))); | 350 base::Passed(event.Pass()))); |
| 351 } | 351 } |
| 352 | 352 |
| 353 // static | 353 // static |
| 354 void BluetoothSocketEventDispatcher::DispatchEvent( | 354 void BluetoothSocketEventDispatcher::DispatchEvent( |
| 355 void* browser_context_id, | 355 void* browser_context_id, |
| 356 const std::string& extension_id, | 356 const std::string& extension_id, |
| 357 scoped_ptr<Event> event) { | 357 scoped_ptr<Event> event) { |
| 358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 358 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 359 | 359 |
| 360 content::BrowserContext* context = | 360 content::BrowserContext* context = |
| 361 reinterpret_cast<content::BrowserContext*>(browser_context_id); | 361 reinterpret_cast<content::BrowserContext*>(browser_context_id); |
| 362 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) | 362 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext(context)) |
| 363 return; | 363 return; |
| 364 | 364 |
| 365 EventRouter* router = EventRouter::Get(context); | 365 EventRouter* router = EventRouter::Get(context); |
| 366 if (router) | 366 if (router) |
| 367 router->DispatchEventToExtension(extension_id, event.Pass()); | 367 router->DispatchEventToExtension(extension_id, event.Pass()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 } // namespace core_api | 370 } // namespace core_api |
| 371 } // namespace extensions | 371 } // namespace extensions |
| OLD | NEW |