| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) | 2 * Copyright (C) 2000 Harri Porten (porten@kde.org) |
| 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) | 3 * Copyright (c) 2000 Daniel Molkentin (molkentin@kde.org) |
| 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) | 4 * Copyright (c) 2000 Stefan Schimanski (schimmi@kde.org) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "modules/geolocation/NavigatorGeolocation.h" | 24 #include "modules/geolocation/NavigatorGeolocation.h" |
| 25 | 25 |
| 26 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
| 27 #include "core/frame/LocalFrame.h" | 27 #include "core/frame/LocalFrame.h" |
| 28 #include "core/frame/Navigator.h" | 28 #include "core/frame/Navigator.h" |
| 29 #include "modules/geolocation/Geolocation.h" | 29 #include "modules/geolocation/Geolocation.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 NavigatorGeolocation::NavigatorGeolocation(LocalFrame* frame) | 33 NavigatorGeolocation::NavigatorGeolocation(Navigator& navigator) |
| 34 : ContextClient(frame) {} | 34 : Supplement<Navigator>(navigator) {} |
| 35 | 35 |
| 36 const char* NavigatorGeolocation::supplementName() { | 36 const char* NavigatorGeolocation::supplementName() { |
| 37 return "NavigatorGeolocation"; | 37 return "NavigatorGeolocation"; |
| 38 } | 38 } |
| 39 | 39 |
| 40 NavigatorGeolocation& NavigatorGeolocation::from(Navigator& navigator) { | 40 NavigatorGeolocation& NavigatorGeolocation::from(Navigator& navigator) { |
| 41 NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>( | 41 NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>( |
| 42 Supplement<Navigator>::from(navigator, supplementName())); | 42 Supplement<Navigator>::from(navigator, supplementName())); |
| 43 if (!supplement) { | 43 if (!supplement) { |
| 44 supplement = new NavigatorGeolocation(navigator.frame()); | 44 supplement = new NavigatorGeolocation(navigator); |
| 45 provideTo(navigator, supplementName(), supplement); | 45 provideTo(navigator, supplementName(), supplement); |
| 46 } | 46 } |
| 47 return *supplement; | 47 return *supplement; |
| 48 } | 48 } |
| 49 | 49 |
| 50 Geolocation* NavigatorGeolocation::geolocation(Navigator& navigator) { | 50 Geolocation* NavigatorGeolocation::geolocation(Navigator& navigator) { |
| 51 return NavigatorGeolocation::from(navigator).geolocation(); | 51 return NavigatorGeolocation::from(navigator).geolocation(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 Geolocation* NavigatorGeolocation::geolocation() { | 54 Geolocation* NavigatorGeolocation::geolocation() { |
| 55 if (!m_geolocation && frame()) | 55 if (!m_geolocation && host()->frame()) |
| 56 m_geolocation = Geolocation::create(frame()->document()); | 56 m_geolocation = Geolocation::create(host()->frame()->document()); |
| 57 return m_geolocation; | 57 return m_geolocation; |
| 58 } | 58 } |
| 59 | 59 |
| 60 DEFINE_TRACE(NavigatorGeolocation) { | 60 DEFINE_TRACE(NavigatorGeolocation) { |
| 61 visitor->trace(m_geolocation); | 61 visitor->trace(m_geolocation); |
| 62 Supplement<Navigator>::trace(visitor); | 62 Supplement<Navigator>::trace(visitor); |
| 63 ContextClient::trace(visitor); | |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |