Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6229)

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc

Issue 420663003: Extensions: Move bluetooth APIs to extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android, gn Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
deleted file mode 100644
index bbc4fbd6bcebc273c64fa59872950510b977d962..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h"
-
-#include "base/memory/ref_counted.h"
-#include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
-#include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
-#include "content/public/browser/browser_thread.h"
-#include "device/bluetooth/bluetooth_adapter.h"
-#include "device/bluetooth/bluetooth_adapter_factory.h"
-
-using content::BrowserThread;
-
-namespace {
-
-const char kPlatformNotSupported[] =
- "This operation is not supported on your platform";
-
-extensions::BluetoothEventRouter* GetEventRouter(
- content::BrowserContext* context) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- return extensions::BluetoothAPI::Get(context)->event_router();
-}
-
-bool IsBluetoothSupported(content::BrowserContext* context) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- return GetEventRouter(context)->IsBluetoothSupported();
-}
-
-void GetAdapter(const device::BluetoothAdapterFactory::AdapterCallback callback,
- content::BrowserContext* context) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- GetEventRouter(context)->GetAdapter(callback);
-}
-
-} // namespace
-
-namespace extensions {
-namespace api {
-
-BluetoothExtensionFunction::BluetoothExtensionFunction() {
-}
-
-BluetoothExtensionFunction::~BluetoothExtensionFunction() {
-}
-
-bool BluetoothExtensionFunction::RunAsync() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
- if (!IsBluetoothSupported(browser_context())) {
- SetError(kPlatformNotSupported);
- return false;
- }
- GetAdapter(base::Bind(&BluetoothExtensionFunction::RunOnAdapterReady, this),
- browser_context());
-
- return true;
-}
-
-void BluetoothExtensionFunction::RunOnAdapterReady(
- scoped_refptr<device::BluetoothAdapter> adapter) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DoWork(adapter);
-}
-
-} // namespace api
-} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698