| 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 "modules/geofencing/ServiceWorkerRegistrationGeofencing.h" | |
| 6 | |
| 7 #include "modules/geofencing/Geofencing.h" | |
| 8 #include "modules/serviceworkers/ServiceWorkerRegistration.h" | |
| 9 | |
| 10 namespace blink { | |
| 11 | |
| 12 ServiceWorkerRegistrationGeofencing::ServiceWorkerRegistrationGeofencing(Service
WorkerRegistration* registration) | |
| 13 : m_registration(registration) | |
| 14 { | |
| 15 } | |
| 16 | |
| 17 ServiceWorkerRegistrationGeofencing::~ServiceWorkerRegistrationGeofencing() | |
| 18 { | |
| 19 } | |
| 20 | |
| 21 const char* ServiceWorkerRegistrationGeofencing::supplementName() | |
| 22 { | |
| 23 return "ServiceWorkerRegistrationGeofencing"; | |
| 24 } | |
| 25 | |
| 26 ServiceWorkerRegistrationGeofencing& ServiceWorkerRegistrationGeofencing::from(S
erviceWorkerRegistration& registration) | |
| 27 { | |
| 28 ServiceWorkerRegistrationGeofencing* supplement = static_cast<ServiceWorkerR
egistrationGeofencing*>(Supplement<ServiceWorkerRegistration>::from(registration
, supplementName())); | |
| 29 if (!supplement) { | |
| 30 supplement = new ServiceWorkerRegistrationGeofencing(®istration); | |
| 31 provideTo(registration, supplementName(), supplement); | |
| 32 } | |
| 33 return *supplement; | |
| 34 } | |
| 35 | |
| 36 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing(ServiceWorkerRegistr
ation& registration) | |
| 37 { | |
| 38 return ServiceWorkerRegistrationGeofencing::from(registration).geofencing(); | |
| 39 } | |
| 40 | |
| 41 Geofencing* ServiceWorkerRegistrationGeofencing::geofencing() | |
| 42 { | |
| 43 if (!m_geofencing) | |
| 44 m_geofencing = Geofencing::create(m_registration); | |
| 45 return m_geofencing.get(); | |
| 46 } | |
| 47 | |
| 48 DEFINE_TRACE(ServiceWorkerRegistrationGeofencing) | |
| 49 { | |
| 50 visitor->trace(m_registration); | |
| 51 visitor->trace(m_geofencing); | |
| 52 Supplement<ServiceWorkerRegistration>::trace(visitor); | |
| 53 } | |
| 54 | |
| 55 } // namespace blink | |
| OLD | NEW |