| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_extension_function.h
" | 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h
" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
| 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 namespace extensions { | 40 namespace extensions { |
| 41 namespace api { | 41 namespace api { |
| 42 | 42 |
| 43 BluetoothExtensionFunction::BluetoothExtensionFunction() { | 43 BluetoothExtensionFunction::BluetoothExtensionFunction() { |
| 44 } | 44 } |
| 45 | 45 |
| 46 BluetoothExtensionFunction::~BluetoothExtensionFunction() { | 46 BluetoothExtensionFunction::~BluetoothExtensionFunction() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 bool BluetoothExtensionFunction::RunImpl() { | 49 bool BluetoothExtensionFunction::RunAsync() { |
| 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 50 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 51 | 51 |
| 52 if (!IsBluetoothSupported(browser_context())) { | 52 if (!IsBluetoothSupported(browser_context())) { |
| 53 SetError(kPlatformNotSupported); | 53 SetError(kPlatformNotSupported); |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 GetAdapter(base::Bind(&BluetoothExtensionFunction::RunOnAdapterReady, this), | 56 GetAdapter(base::Bind(&BluetoothExtensionFunction::RunOnAdapterReady, this), |
| 57 browser_context()); | 57 browser_context()); |
| 58 | 58 |
| 59 return true; | 59 return true; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void BluetoothExtensionFunction::RunOnAdapterReady( | 62 void BluetoothExtensionFunction::RunOnAdapterReady( |
| 63 scoped_refptr<device::BluetoothAdapter> adapter) { | 63 scoped_refptr<device::BluetoothAdapter> adapter) { |
| 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 65 DoWork(adapter); | 65 DoWork(adapter); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace api | 68 } // namespace api |
| 69 } // namespace extensions | 69 } // namespace extensions |
| OLD | NEW |