OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | |
6 | |
7 #include "chrome/browser/extensions/extension_service.h" | |
8 #include "chrome/browser/profiles/profile.h" | |
9 | |
10 #if defined(OS_CHROMEOS) | |
11 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | |
12 #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h" | |
13 #endif | |
14 | |
15 namespace extensions { | |
16 namespace api { | |
17 | |
18 #if defined(OS_CHROMEOS) | |
19 bool BluetoothIsAvailableFunction::RunImpl() { | |
20 const chromeos::BluetoothAdapter *adapter = | |
21 profile()->GetExtensionService()->bluetooth_event_router()->adapter(); | |
22 if (!adapter) | |
23 return false; | |
Mihai Parparita -not on Chrome
2012/03/21 21:48:52
You have a DCHECK for adapter not being null in Bl
bryeung
2012/03/22 00:37:04
Thank you for pointing this out. I removed the if
| |
24 | |
25 result_.reset(Value::CreateBooleanValue(adapter->IsPresent())); | |
26 SendResponse(true); | |
asargent_no_longer_on_chrome
2012/03/21 21:19:58
Since you can synchronously answer the question on
bryeung
2012/03/21 21:34:14
Thanks for the clarification: done.
| |
27 return true; | |
28 } | |
29 | |
30 bool BluetoothIsPoweredFunction::RunImpl() { | |
asargent_no_longer_on_chrome
2012/03/21 21:19:58
same thing here
bryeung
2012/03/21 21:34:14
Done.
| |
31 const chromeos::BluetoothAdapter *adapter = | |
32 profile()->GetExtensionService()->bluetooth_event_router()->adapter(); | |
33 if (!adapter) | |
34 return false; | |
35 | |
36 result_.reset(Value::CreateBooleanValue(adapter->IsPowered())); | |
37 SendResponse(true); | |
38 return true; | |
39 } | |
40 | |
41 #else | |
42 | |
43 // ----------------------------------------------------------------------------- | |
44 // NIY stubs | |
45 // ----------------------------------------------------------------------------- | |
46 bool BluetoothIsAvailableFunction::RunImpl() { | |
47 NOTREACHED() << "Not implemented yet"; | |
48 return false; | |
49 } | |
50 | |
51 bool BluetoothIsPoweredFunction::RunImpl() { | |
52 NOTREACHED() << "Not implemented yet"; | |
53 return false; | |
54 } | |
55 | |
56 #endif | |
57 | |
58 bool BluetoothDisconnectFunction::RunImpl() { | |
59 NOTREACHED() << "Not implemented yet"; | |
60 return false; | |
61 } | |
62 | |
63 bool BluetoothReadFunction::RunImpl() { | |
64 NOTREACHED() << "Not implemented yet"; | |
65 return false; | |
66 } | |
67 | |
68 bool BluetoothSetOutOfBandPairingDataFunction::RunImpl() { | |
69 NOTREACHED() << "Not implemented yet"; | |
70 return false; | |
71 } | |
72 | |
73 bool BluetoothGetOutOfBandPairingDataFunction::RunImpl() { | |
74 NOTREACHED() << "Not implemented yet"; | |
75 return false; | |
76 } | |
77 | |
78 bool BluetoothGetAddressFunction::RunImpl() { | |
79 NOTREACHED() << "Not implemented yet"; | |
80 return false; | |
81 } | |
82 | |
83 bool BluetoothWriteFunction::RunImpl() { | |
84 NOTREACHED() << "Not implemented yet"; | |
85 return false; | |
86 } | |
87 | |
88 bool BluetoothConnectFunction::RunImpl() { | |
89 NOTREACHED() << "Not implemented yet"; | |
90 return false; | |
91 } | |
92 | |
93 bool BluetoothGetDevicesWithServiceFunction::RunImpl() { | |
94 NOTREACHED() << "Not implemented yet"; | |
95 return false; | |
96 } | |
97 | |
98 } // namespace api | |
99 } // namespace extensions | |
OLD | NEW |