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

Side by Side 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: add test 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/geofencing/ServiceWorkerRegistrationGeofencing.h"
7
8 #include "modules/geofencing/Geofencing.h"
9 #include "modules/serviceworkers/ServiceWorkerRegistration.h"
10
11 namespace blink {
12
13 ServiceWorkerRegistrationGeofencing::ServiceWorkerRegistrationGeofencing(Service WorkerRegistration* registration)
14 : m_registration(registration)
15 {
16 }
17
18 ServiceWorkerRegistrationGeofencing::~ServiceWorkerRegistrationGeofencing()
19 {
20 }
21
22 const char* ServiceWorkerRegistrationGeofencing::supplementName()
23 {
24 return "ServiceWorkerRegistrationGeofencing";
25 }
26
27 ServiceWorkerRegistrationGeofencing& ServiceWorkerRegistrationGeofencing::from(S erviceWorkerRegistration& navigator)
jsbell 2014/10/08 18:51:57 Rename 'navigator' to 'registration'
Marijn Kruisselbrink 2014/10/08 23:00:32 argh, the danger of copy-paste coding... fixed.
28 {
29 ServiceWorkerRegistrationGeofencing* supplement = static_cast<ServiceWorkerR egistrationGeofencing*>(HeapSupplement<ServiceWorkerRegistration>::from(navigato r, supplementName()));
30 if (!supplement) {
31 supplement = new ServiceWorkerRegistrationGeofencing(&navigator);
32 provideTo(navigator, supplementName(), supplement);
33 }
34 return *supplement;
35 }
36
37 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing(ServiceWorkerRegistr ation& navigator)
jsbell 2014/10/08 18:51:57 Ditto
Marijn Kruisselbrink 2014/10/08 23:00:32 Done.
38 {
39 return ServiceWorkerRegistrationGeofencing::from(navigator).geofencing();
40 }
41
42 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing()
43 {
44 if (!m_geofencing)
45 m_geofencing = Geofencing::create(m_registration);
46 return m_geofencing.get();
47 }
48
49 void ServiceWorkerRegistrationGeofencing::trace(Visitor* visitor)
50 {
51 visitor->trace(m_registration);
52 visitor->trace(m_geofencing);
53 HeapSupplement<ServiceWorkerRegistration>::trace(visitor);
54 }
55
56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698