Commit 8b5d6d41 authored by haraken's avatar haraken Committed by Commit bot

Remove ContextClient from NavigatorGeolocation

Now that Navigator's supplement can get a Navigator object via host().
Then Navigator's supplement doesn't need to observe ContextClient.

BUG=610176

Review-Url: https://codereview.chromium.org/2618773004
Cr-Commit-Position: refs/heads/master@{#441893}
parent 121a875a
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
namespace blink { namespace blink {
NavigatorGeolocation::NavigatorGeolocation(LocalFrame* frame) NavigatorGeolocation::NavigatorGeolocation(Navigator& navigator)
: ContextClient(frame) {} : Supplement<Navigator>(navigator) {}
const char* NavigatorGeolocation::supplementName() { const char* NavigatorGeolocation::supplementName() {
return "NavigatorGeolocation"; return "NavigatorGeolocation";
...@@ -41,7 +41,7 @@ NavigatorGeolocation& NavigatorGeolocation::from(Navigator& navigator) { ...@@ -41,7 +41,7 @@ NavigatorGeolocation& NavigatorGeolocation::from(Navigator& navigator) {
NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>( NavigatorGeolocation* supplement = static_cast<NavigatorGeolocation*>(
Supplement<Navigator>::from(navigator, supplementName())); Supplement<Navigator>::from(navigator, supplementName()));
if (!supplement) { if (!supplement) {
supplement = new NavigatorGeolocation(navigator.frame()); supplement = new NavigatorGeolocation(navigator);
provideTo(navigator, supplementName(), supplement); provideTo(navigator, supplementName(), supplement);
} }
return *supplement; return *supplement;
...@@ -52,15 +52,14 @@ Geolocation* NavigatorGeolocation::geolocation(Navigator& navigator) { ...@@ -52,15 +52,14 @@ Geolocation* NavigatorGeolocation::geolocation(Navigator& navigator) {
} }
Geolocation* NavigatorGeolocation::geolocation() { Geolocation* NavigatorGeolocation::geolocation() {
if (!m_geolocation && frame()) if (!m_geolocation && host()->frame())
m_geolocation = Geolocation::create(frame()->document()); m_geolocation = Geolocation::create(host()->frame()->document());
return m_geolocation; return m_geolocation;
} }
DEFINE_TRACE(NavigatorGeolocation) { DEFINE_TRACE(NavigatorGeolocation) {
visitor->trace(m_geolocation); visitor->trace(m_geolocation);
Supplement<Navigator>::trace(visitor); Supplement<Navigator>::trace(visitor);
ContextClient::trace(visitor);
} }
} // namespace blink } // namespace blink
...@@ -20,21 +20,18 @@ ...@@ -20,21 +20,18 @@
#ifndef NavigatorGeolocation_h #ifndef NavigatorGeolocation_h
#define NavigatorGeolocation_h #define NavigatorGeolocation_h
#include "core/dom/ContextLifecycleObserver.h"
#include "core/frame/Navigator.h" #include "core/frame/Navigator.h"
#include "platform/Supplementable.h" #include "platform/Supplementable.h"
#include "platform/heap/Handle.h" #include "platform/heap/Handle.h"
namespace blink { namespace blink {
class LocalFrame;
class Geolocation; class Geolocation;
class Navigator; class Navigator;
class NavigatorGeolocation final class NavigatorGeolocation final
: public GarbageCollected<NavigatorGeolocation>, : public GarbageCollected<NavigatorGeolocation>,
public Supplement<Navigator>, public Supplement<Navigator> {
public ContextClient {
USING_GARBAGE_COLLECTED_MIXIN(NavigatorGeolocation); USING_GARBAGE_COLLECTED_MIXIN(NavigatorGeolocation);
public: public:
...@@ -45,7 +42,7 @@ class NavigatorGeolocation final ...@@ -45,7 +42,7 @@ class NavigatorGeolocation final
DECLARE_TRACE(); DECLARE_TRACE();
private: private:
explicit NavigatorGeolocation(LocalFrame*); explicit NavigatorGeolocation(Navigator&);
static const char* supplementName(); static const char* supplementName();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment