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_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 "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" | |
10 #include "chrome/common/extensions/api/bluetooth_private.h" | |
11 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
12 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
| 11 #include "extensions/browser/api/bluetooth/bluetooth_api_utils.h" |
13 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
14 #include "extensions/browser/extension_system.h" | 13 #include "extensions/browser/extension_system.h" |
| 14 #include "extensions/common/api/bluetooth_private.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 | 17 |
18 namespace bt_private = api::bluetooth_private; | 18 namespace bt_private = core_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 api::bluetooth::BluetoothDeviceToApiDevice(*device, &out->device); | 25 core_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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const bt_private::PairingEvent& pairing_event) { | 102 const bt_private::PairingEvent& pairing_event) { |
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( | 105 scoped_ptr<Event> event( |
106 new Event(bt_private::OnPairing::kEventName, args.Pass())); | 106 new Event(bt_private::OnPairing::kEventName, args.Pass())); |
107 EventRouter::Get(browser_context_) | 107 EventRouter::Get(browser_context_) |
108 ->DispatchEventToExtension(extension_id_, event.Pass()); | 108 ->DispatchEventToExtension(extension_id_, event.Pass()); |
109 } | 109 } |
110 | 110 |
111 } // namespace extensions | 111 } // namespace extensions |
OLD | NEW |