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

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

Issue 9822001: Basic infrastructure for the Bluetooth API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more review comments Created 8 years, 9 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_api.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6a91e6baff55702d31a253436cc6913fdca9ee9f
--- /dev/null
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
@@ -0,0 +1,91 @@
+// 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_api.h"
+
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
+
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
+#include "chrome/browser/chromeos/extensions/bluetooth_event_router.h"
+#endif
+
+namespace extensions {
+namespace api {
+
+#if defined(OS_CHROMEOS)
+bool BluetoothIsAvailableFunction::RunImpl() {
+ const chromeos::BluetoothAdapter *adapter =
+ profile()->GetExtensionService()->bluetooth_event_router()->adapter();
+ result_.reset(Value::CreateBooleanValue(adapter->IsPresent()));
+ return true;
+}
+
+bool BluetoothIsPoweredFunction::RunImpl() {
+ const chromeos::BluetoothAdapter *adapter =
+ profile()->GetExtensionService()->bluetooth_event_router()->adapter();
+ result_.reset(Value::CreateBooleanValue(adapter->IsPowered()));
+ return true;
+}
+
+#else
+
+// -----------------------------------------------------------------------------
+// NIY stubs
+// -----------------------------------------------------------------------------
+bool BluetoothIsAvailableFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothIsPoweredFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+#endif
+
+bool BluetoothDisconnectFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothReadFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothSetOutOfBandPairingDataFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothGetOutOfBandPairingDataFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothGetAddressFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothWriteFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothConnectFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+bool BluetoothGetDevicesWithServiceFunction::RunImpl() {
+ NOTREACHED() << "Not implemented yet";
+ return false;
+}
+
+} // namespace api
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698