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 result_.reset(Value::CreateBooleanValue(adapter->IsPresent())); |
| 23 return true; |
| 24 } |
| 25 |
| 26 bool BluetoothIsPoweredFunction::RunImpl() { |
| 27 const chromeos::BluetoothAdapter *adapter = |
| 28 profile()->GetExtensionService()->bluetooth_event_router()->adapter(); |
| 29 result_.reset(Value::CreateBooleanValue(adapter->IsPowered())); |
| 30 return true; |
| 31 } |
| 32 |
| 33 #else |
| 34 |
| 35 // ----------------------------------------------------------------------------- |
| 36 // NIY stubs |
| 37 // ----------------------------------------------------------------------------- |
| 38 bool BluetoothIsAvailableFunction::RunImpl() { |
| 39 NOTREACHED() << "Not implemented yet"; |
| 40 return false; |
| 41 } |
| 42 |
| 43 bool BluetoothIsPoweredFunction::RunImpl() { |
| 44 NOTREACHED() << "Not implemented yet"; |
| 45 return false; |
| 46 } |
| 47 |
| 48 #endif |
| 49 |
| 50 bool BluetoothDisconnectFunction::RunImpl() { |
| 51 NOTREACHED() << "Not implemented yet"; |
| 52 return false; |
| 53 } |
| 54 |
| 55 bool BluetoothReadFunction::RunImpl() { |
| 56 NOTREACHED() << "Not implemented yet"; |
| 57 return false; |
| 58 } |
| 59 |
| 60 bool BluetoothSetOutOfBandPairingDataFunction::RunImpl() { |
| 61 NOTREACHED() << "Not implemented yet"; |
| 62 return false; |
| 63 } |
| 64 |
| 65 bool BluetoothGetOutOfBandPairingDataFunction::RunImpl() { |
| 66 NOTREACHED() << "Not implemented yet"; |
| 67 return false; |
| 68 } |
| 69 |
| 70 bool BluetoothGetAddressFunction::RunImpl() { |
| 71 NOTREACHED() << "Not implemented yet"; |
| 72 return false; |
| 73 } |
| 74 |
| 75 bool BluetoothWriteFunction::RunImpl() { |
| 76 NOTREACHED() << "Not implemented yet"; |
| 77 return false; |
| 78 } |
| 79 |
| 80 bool BluetoothConnectFunction::RunImpl() { |
| 81 NOTREACHED() << "Not implemented yet"; |
| 82 return false; |
| 83 } |
| 84 |
| 85 bool BluetoothGetDevicesWithServiceFunction::RunImpl() { |
| 86 NOTREACHED() << "Not implemented yet"; |
| 87 return false; |
| 88 } |
| 89 |
| 90 } // namespace api |
| 91 } // namespace extensions |
OLD | NEW |