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/bluetooth_api_pairing_delegate.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_api_pairing_delegate.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
11 #include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" | 11 #include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" |
12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
13 #include "extensions/browser/extension_system.h" | 13 #include "extensions/browser/extension_system.h" |
14 #include "extensions/common/api/bluetooth_private.h" | 14 #include "extensions/common/api/bluetooth_private.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 namespace bt_private = core_api::bluetooth_private; | 18 namespace bt_private = api::bluetooth_private; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 void PopulatePairingEvent(const device::BluetoothDevice* device, | 22 void PopulatePairingEvent(const device::BluetoothDevice* device, |
23 bt_private::PairingEventType type, | 23 bt_private::PairingEventType type, |
24 bt_private::PairingEvent* out) { | 24 bt_private::PairingEvent* out) { |
25 core_api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device); | 25 api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device); |
26 out->pairing = type; | 26 out->pairing = type; |
27 } | 27 } |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 BluetoothApiPairingDelegate::BluetoothApiPairingDelegate( | 31 BluetoothApiPairingDelegate::BluetoothApiPairingDelegate( |
32 const std::string& extension_id, | 32 const std::string& extension_id, |
33 content::BrowserContext* browser_context) | 33 content::BrowserContext* browser_context) |
34 : extension_id_(extension_id), browser_context_(browser_context) {} | 34 : extension_id_(extension_id), browser_context_(browser_context) {} |
35 | 35 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 scoped_ptr<base::ListValue> args = | 103 scoped_ptr<base::ListValue> args = |
104 bt_private::OnPairing::Create(pairing_event); | 104 bt_private::OnPairing::Create(pairing_event); |
105 scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING, | 105 scoped_ptr<Event> event(new Event(events::BLUETOOTH_PRIVATE_ON_PAIRING, |
106 bt_private::OnPairing::kEventName, | 106 bt_private::OnPairing::kEventName, |
107 args.Pass())); | 107 args.Pass())); |
108 EventRouter::Get(browser_context_) | 108 EventRouter::Get(browser_context_) |
109 ->DispatchEventToExtension(extension_id_, event.Pass()); | 109 ->DispatchEventToExtension(extension_id_, event.Pass()); |
110 } | 110 } |
111 | 111 |
112 } // namespace extensions | 112 } // namespace extensions |
OLD | NEW |