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/NavigatorGeofencing.h" 7 8 #include "core/frame/Navigator.h" 9 #include "modules/geofencing/Geofencing.h" 10 11 namespace blink { 12 NavigatorGeofencing()13NavigatorGeofencing::NavigatorGeofencing() 14 { 15 } 16 ~NavigatorGeofencing()17NavigatorGeofencing::~NavigatorGeofencing() 18 { 19 } 20 supplementName()21const char* NavigatorGeofencing::supplementName() 22 { 23 return "NavigatorGeofencing"; 24 } 25 from(Navigator & navigator)26NavigatorGeofencing& NavigatorGeofencing::from(Navigator& navigator) 27 { 28 NavigatorGeofencing* supplement = static_cast<NavigatorGeofencing*>(WillBeHeapSupplement<Navigator>::from(navigator, supplementName())); 29 if (!supplement) { 30 supplement = new NavigatorGeofencing(); 31 provideTo(navigator, supplementName(), adoptPtrWillBeNoop(supplement)); 32 } 33 return *supplement; 34 } 35 geofencing(Navigator & navigator)36Geofencing* NavigatorGeofencing::geofencing(Navigator& navigator) 37 { 38 return NavigatorGeofencing::from(navigator).geofencing(); 39 } 40 geofencing()41Geofencing* NavigatorGeofencing::geofencing() 42 { 43 if (!m_geofencing) 44 m_geofencing = Geofencing::create(); 45 return m_geofencing.get(); 46 } 47 trace(Visitor * visitor)48void NavigatorGeofencing::trace(Visitor* visitor) 49 { 50 visitor->trace(m_geofencing); 51 WillBeHeapSupplement<Navigator>::trace(visitor); 52 } 53 54 } // namespace blink 55