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

Unified Diff: Source/modules/bluetooth/NavigatorBluetooth.cpp

Issue 639533002: bluetooth: Extend navigator.bluetooth IDL to include Bluetooth interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/modules/bluetooth/NavigatorBluetooth.h ('k') | Source/modules/bluetooth/NavigatorBluetooth.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/bluetooth/NavigatorBluetooth.cpp
diff --git a/Source/modules/bluetooth/NavigatorBluetooth.cpp b/Source/modules/bluetooth/NavigatorBluetooth.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..01738d18a3baac9e7a13c1c5dd6e285204ecdf5c
--- /dev/null
+++ b/Source/modules/bluetooth/NavigatorBluetooth.cpp
@@ -0,0 +1,52 @@
+// Copyright 2014 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 "config.h"
+#include "modules/bluetooth/NavigatorBluetooth.h"
+
+#include "core/frame/Navigator.h"
+#include "modules/bluetooth/Bluetooth.h"
+
+namespace blink {
+
+NavigatorBluetooth& NavigatorBluetooth::from(Navigator& navigator)
+{
+ NavigatorBluetooth* supplement = static_cast<NavigatorBluetooth*>(WillBeHeapSupplement<Navigator>::from(navigator, supplementName()));
+ if (!supplement) {
+ supplement = new NavigatorBluetooth();
+ provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
+ }
+ return *supplement;
+}
+
+Bluetooth* NavigatorBluetooth::bluetooth(Navigator& navigator)
+{
+ return NavigatorBluetooth::from(navigator).bluetooth();
+}
+
+Bluetooth* NavigatorBluetooth::bluetooth()
+{
+ if (!m_bluetooth)
+ m_bluetooth = Bluetooth::create();
+ return m_bluetooth.get();
+}
+
+void NavigatorBluetooth::trace(Visitor* visitor)
+{
+ visitor->trace(m_bluetooth);
+ WillBeHeapSupplement<Navigator>::trace(visitor);
+}
+
+NavigatorBluetooth::NavigatorBluetooth()
+{
+}
+
+DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(NavigatorBluetooth);
+
+const char* NavigatorBluetooth::supplementName()
+{
+ return "NavigatorBluetooth";
+}
+
+} // namespace blink
« no previous file with comments | « Source/modules/bluetooth/NavigatorBluetooth.h ('k') | Source/modules/bluetooth/NavigatorBluetooth.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698