OLD | NEW |
---|---|
(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 | |
OLD | NEW |