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

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

Issue 623813002: Blink side of exposing the service worker registration associated with geofencing API calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: hopefully correctly fix compile 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
Index: Source/modules/geofencing/ServiceWorkerRegistrationGeofencing.cpp
diff --git a/Source/modules/geofencing/ServiceWorkerRegistrationGeofencing.cpp b/Source/modules/geofencing/ServiceWorkerRegistrationGeofencing.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..009f0af1aee8d0e4148380242c417bf05e13140a
--- /dev/null
+++ b/Source/modules/geofencing/ServiceWorkerRegistrationGeofencing.cpp
@@ -0,0 +1,56 @@
+// 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/ServiceWorkerRegistrationGeofencing.h"
+
+#include "modules/geofencing/Geofencing.h"
+#include "modules/serviceworkers/ServiceWorkerRegistration.h"
+
+namespace blink {
+
+ServiceWorkerRegistrationGeofencing::ServiceWorkerRegistrationGeofencing(ServiceWorkerRegistration* registration)
+ : m_registration(registration)
+{
+}
+
+ServiceWorkerRegistrationGeofencing::~ServiceWorkerRegistrationGeofencing()
+{
+}
+
+const char* ServiceWorkerRegistrationGeofencing::supplementName()
+{
+ return "ServiceWorkerRegistrationGeofencing";
+}
+
+ServiceWorkerRegistrationGeofencing& ServiceWorkerRegistrationGeofencing::from(ServiceWorkerRegistration& registration)
+{
+ ServiceWorkerRegistrationGeofencing* supplement = static_cast<ServiceWorkerRegistrationGeofencing*>(HeapSupplement<ServiceWorkerRegistration>::from(registration, supplementName()));
+ if (!supplement) {
+ supplement = new ServiceWorkerRegistrationGeofencing(&registration);
+ provideTo(registration, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+Geofencing* ServiceWorkerRegistrationGeofencing::geofencing(ServiceWorkerRegistration& registration)
+{
+ return ServiceWorkerRegistrationGeofencing::from(registration).geofencing();
+}
+
+Geofencing* ServiceWorkerRegistrationGeofencing::geofencing()
+{
+ if (!m_geofencing)
+ m_geofencing = Geofencing::create(m_registration);
+ return m_geofencing.get();
+}
+
+void ServiceWorkerRegistrationGeofencing::trace(Visitor* visitor)
+{
+ visitor->trace(m_registration);
+ visitor->trace(m_geofencing);
+ HeapSupplement<ServiceWorkerRegistration>::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698