| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bluetooth_event_router.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 void BluetoothEventRouter::OnListenerRemoved() { | 368 void BluetoothEventRouter::OnListenerRemoved() { |
| 369 if (num_event_listeners_ > 0) | 369 if (num_event_listeners_ > 0) |
| 370 num_event_listeners_--; | 370 num_event_listeners_--; |
| 371 MaybeReleaseAdapter(); | 371 MaybeReleaseAdapter(); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void BluetoothEventRouter::DispatchAdapterStateEvent() { | 374 void BluetoothEventRouter::DispatchAdapterStateEvent() { |
| 375 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 375 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 376 api::bluetooth::AdapterState state; | 376 api::bluetooth::AdapterState state; |
| 377 CHECK(adapter_.get()); | 377 CHECK(adapter_.get()); |
| 378 PopulateAdapterState(*adapter_.get(), &state); | 378 PopulateAdapterState(*adapter_, &state); |
| 379 | 379 |
| 380 std::unique_ptr<base::ListValue> args = | 380 std::unique_ptr<base::ListValue> args = |
| 381 bluetooth::OnAdapterStateChanged::Create(state); | 381 bluetooth::OnAdapterStateChanged::Create(state); |
| 382 std::unique_ptr<Event> event( | 382 std::unique_ptr<Event> event( |
| 383 new Event(events::BLUETOOTH_ON_ADAPTER_STATE_CHANGED, | 383 new Event(events::BLUETOOTH_ON_ADAPTER_STATE_CHANGED, |
| 384 bluetooth::OnAdapterStateChanged::kEventName, std::move(args))); | 384 bluetooth::OnAdapterStateChanged::kEventName, std::move(args))); |
| 385 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); | 385 EventRouter::Get(browser_context_)->BroadcastEvent(std::move(event)); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void BluetoothEventRouter::DispatchDeviceEvent( | 388 void BluetoothEventRouter::DispatchDeviceEvent( |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } | 467 } |
| 468 | 468 |
| 469 void BluetoothEventRouter::OnExtensionUnloaded( | 469 void BluetoothEventRouter::OnExtensionUnloaded( |
| 470 content::BrowserContext* browser_context, | 470 content::BrowserContext* browser_context, |
| 471 const Extension* extension, | 471 const Extension* extension, |
| 472 UnloadedExtensionInfo::Reason reason) { | 472 UnloadedExtensionInfo::Reason reason) { |
| 473 CleanUpForExtension(extension->id()); | 473 CleanUpForExtension(extension->id()); |
| 474 } | 474 } |
| 475 | 475 |
| 476 } // namespace extensions | 476 } // namespace extensions |
| OLD | NEW |