| 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_low_energy/bluetooth_low_energy_api.h
      " |     5 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_api.h
      " | 
|     6  |     6  | 
|     7 #include <algorithm> |     7 #include <algorithm> | 
|     8  |     8  | 
|     9 #include "base/bind.h" |     9 #include "base/bind.h" | 
|    10 #include "base/lazy_instance.h" |    10 #include "base/lazy_instance.h" | 
|    11 #include "base/strings/stringprintf.h" |    11 #include "base/strings/stringprintf.h" | 
|    12 #include "content/public/browser/browser_thread.h" |    12 #include "content/public/browser/browser_thread.h" | 
|    13 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisemen
      t.h" |    13 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_api_advertisemen
      t.h" | 
|    14 #include "extensions/browser/api/bluetooth_low_energy/utils.h" |    14 #include "extensions/browser/api/bluetooth_low_energy/utils.h" | 
|    15 #include "extensions/browser/event_router.h" |    15 #include "extensions/browser/event_router.h" | 
|    16 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" |    16 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" | 
|    17 #include "extensions/common/api/bluetooth_low_energy.h" |    17 #include "extensions/common/api/bluetooth_low_energy.h" | 
|    18 #include "extensions/common/permissions/permissions_data.h" |    18 #include "extensions/common/permissions/permissions_data.h" | 
|    19  |    19  | 
|    20 using content::BrowserContext; |    20 using content::BrowserContext; | 
|    21 using content::BrowserThread; |    21 using content::BrowserThread; | 
|    22  |    22  | 
|    23 namespace apibtle = extensions::core_api::bluetooth_low_energy; |    23 namespace apibtle = extensions::api::bluetooth_low_energy; | 
|    24  |    24  | 
|    25 namespace extensions { |    25 namespace extensions { | 
|    26  |    26  | 
|    27 namespace { |    27 namespace { | 
|    28  |    28  | 
|    29 const char kErrorAdapterNotInitialized[] = |    29 const char kErrorAdapterNotInitialized[] = | 
|    30     "Could not initialize Bluetooth adapter"; |    30     "Could not initialize Bluetooth adapter"; | 
|    31 const char kErrorAlreadyConnected[] = "Already connected"; |    31 const char kErrorAlreadyConnected[] = "Already connected"; | 
|    32 const char kErrorAlreadyNotifying[] = "Already notifying"; |    32 const char kErrorAlreadyNotifying[] = "Already notifying"; | 
|    33 const char kErrorAuthenticationFailed[] = "Authentication failed"; |    33 const char kErrorAuthenticationFailed[] = "Authentication failed"; | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   156   DCHECK_CURRENTLY_ON(BrowserThread::UI); |   156   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
|   157 } |   157 } | 
|   158  |   158  | 
|   159 BluetoothLowEnergyAPI::~BluetoothLowEnergyAPI() { |   159 BluetoothLowEnergyAPI::~BluetoothLowEnergyAPI() { | 
|   160 } |   160 } | 
|   161  |   161  | 
|   162 void BluetoothLowEnergyAPI::Shutdown() { |   162 void BluetoothLowEnergyAPI::Shutdown() { | 
|   163   DCHECK_CURRENTLY_ON(BrowserThread::UI); |   163   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
|   164 } |   164 } | 
|   165  |   165  | 
|   166 namespace core_api { |   166 namespace api { | 
|   167  |   167  | 
|   168 BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() { |   168 BluetoothLowEnergyExtensionFunction::BluetoothLowEnergyExtensionFunction() { | 
|   169 } |   169 } | 
|   170  |   170  | 
|   171 BluetoothLowEnergyExtensionFunction::~BluetoothLowEnergyExtensionFunction() { |   171 BluetoothLowEnergyExtensionFunction::~BluetoothLowEnergyExtensionFunction() { | 
|   172 } |   172 } | 
|   173  |   173  | 
|   174 bool BluetoothLowEnergyExtensionFunction::RunAsync() { |   174 bool BluetoothLowEnergyExtensionFunction::RunAsync() { | 
|   175   DCHECK_CURRENTLY_ON(BrowserThread::UI); |   175   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
|   176  |   176  | 
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1004     case device::BluetoothAdvertisement::ErrorCode:: |  1004     case device::BluetoothAdvertisement::ErrorCode:: | 
|  1005         ERROR_ADVERTISEMENT_DOES_NOT_EXIST: |  1005         ERROR_ADVERTISEMENT_DOES_NOT_EXIST: | 
|  1006       SetError(kStatusAdvertisementDoesNotExist); |  1006       SetError(kStatusAdvertisementDoesNotExist); | 
|  1007       break; |  1007       break; | 
|  1008     default: |  1008     default: | 
|  1009       SetError(kErrorOperationFailed); |  1009       SetError(kErrorOperationFailed); | 
|  1010   } |  1010   } | 
|  1011   SendResponse(false); |  1011   SendResponse(false); | 
|  1012 } |  1012 } | 
|  1013  |  1013  | 
|  1014 }  // namespace core_api |  1014 }  // namespace api | 
|  1015 }  // namespace extensions |  1015 }  // namespace extensions | 
| OLD | NEW |