| 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_low_energy/bluetooth_low_energ
y_api.h" | 5 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h
" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/extensions/api/bluetooth_low_energy/utils.h" | |
| 11 #include "chrome/common/extensions/api/bluetooth/bluetooth_manifest_data.h" | |
| 12 #include "chrome/common/extensions/api/bluetooth_low_energy.h" | |
| 13 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| 11 #include "extensions/browser/api/bluetooth_low_energy/utils.h" |
| 14 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
| 13 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" |
| 14 #include "extensions/common/api/bluetooth_low_energy.h" |
| 15 #include "extensions/common/permissions/permissions_data.h" | 15 #include "extensions/common/permissions/permissions_data.h" |
| 16 | 16 |
| 17 using content::BrowserContext; | 17 using content::BrowserContext; |
| 18 using content::BrowserThread; | 18 using content::BrowserThread; |
| 19 | 19 |
| 20 namespace apibtle = extensions::api::bluetooth_low_energy; | 20 namespace apibtle = extensions::core_api::bluetooth_low_energy; |
| 21 | 21 |
| 22 namespace extensions { | 22 namespace extensions { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const char kErrorAdapterNotInitialized[] = | 26 const char kErrorAdapterNotInitialized[] = |
| 27 "Could not initialize Bluetooth adapter"; | 27 "Could not initialize Bluetooth adapter"; |
| 28 const char kErrorAlreadyConnected[] = "Already connected"; | 28 const char kErrorAlreadyConnected[] = "Already connected"; |
| 29 const char kErrorAlreadyNotifying[] = "Already notifying"; | 29 const char kErrorAlreadyNotifying[] = "Already notifying"; |
| 30 const char kErrorInProgress[] = "In progress"; | 30 const char kErrorInProgress[] = "In progress"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 BluetoothLowEnergyAPI::~BluetoothLowEnergyAPI() { | 102 BluetoothLowEnergyAPI::~BluetoothLowEnergyAPI() { |
| 103 } | 103 } |
| 104 | 104 |
| 105 void BluetoothLowEnergyAPI::Shutdown() { | 105 void BluetoothLowEnergyAPI::Shutdown() { |
| 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 namespace api { | 109 namespace core_api { |
| 110 | 110 |
| 111 BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() { | 111 BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() { |
| 112 } | 112 } |
| 113 | 113 |
| 114 BluetoothLowEnergyExtensionFunction::~BluetoothLowEnergyExtensionFunction() { | 114 BluetoothLowEnergyExtensionFunction::~BluetoothLowEnergyExtensionFunction() { |
| 115 } | 115 } |
| 116 | 116 |
| 117 bool BluetoothLowEnergyExtensionFunction::RunAsync() { | 117 bool BluetoothLowEnergyExtensionFunction::RunAsync() { |
| 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 118 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 119 | 119 |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 results_ = apibtle::WriteDescriptorValue::Results::Create(); | 762 results_ = apibtle::WriteDescriptorValue::Results::Create(); |
| 763 SendResponse(true); | 763 SendResponse(true); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void BluetoothLowEnergyWriteDescriptorValueFunction::ErrorCallback( | 766 void BluetoothLowEnergyWriteDescriptorValueFunction::ErrorCallback( |
| 767 BluetoothLowEnergyEventRouter::Status status) { | 767 BluetoothLowEnergyEventRouter::Status status) { |
| 768 SetError(StatusToString(status)); | 768 SetError(StatusToString(status)); |
| 769 SendResponse(false); | 769 SendResponse(false); |
| 770 } | 770 } |
| 771 | 771 |
| 772 } // namespace api | 772 } // namespace core_api |
| 773 } // namespace extensions | 773 } // namespace extensions |
| OLD | NEW |