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

Unified Diff: Source/modules/geofencing/NavigatorGeofencing.cpp

Issue 401713005: Move all geofencing code into its own module separate from geolocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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: Source/modules/geofencing/NavigatorGeofencing.cpp
diff --git a/Source/modules/geofencing/NavigatorGeofencing.cpp b/Source/modules/geofencing/NavigatorGeofencing.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4a50edbf34bad7cac52c95bf0035aec01aafc3dd
--- /dev/null
+++ b/Source/modules/geofencing/NavigatorGeofencing.cpp
@@ -0,0 +1,54 @@
+// 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/geofencing/NavigatorGeofencing.h"
+
+#include "core/frame/Navigator.h"
+#include "modules/geofencing/Geofencing.h"
+
+namespace blink {
+
+NavigatorGeofencing::NavigatorGeofencing()
+{
+}
+
+NavigatorGeofencing::~NavigatorGeofencing()
+{
+}
+
+const char* NavigatorGeofencing::supplementName()
+{
+ return "NavigatorGeofencing";
+}
+
+NavigatorGeofencing& NavigatorGeofencing::from(Navigator& navigator)
+{
+ NavigatorGeofencing* supplement = static_cast<NavigatorGeofencing*>(WillBeHeapSupplement<Navigator>::from(navigator, supplementName()));
+ if (!supplement) {
+ supplement = new NavigatorGeofencing();
+ provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement));
+ }
+ return *supplement;
+}
+
+Geofencing* NavigatorGeofencing::geofencing(Navigator& navigator)
+{
+ return NavigatorGeofencing::from(navigator).geofencing();
+}
+
+Geofencing* NavigatorGeofencing::geofencing()
+{
+ if (!m_geofencing)
+ m_geofencing = Geofencing::create();
+ return m_geofencing.get();
+}
+
+void NavigatorGeofencing::trace(Visitor* visitor)
+{
+ visitor->trace(m_geofencing);
+ WillBeHeapSupplement<Navigator>::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698