diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp index 74b90797f..5f5408024 100644 --- a/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebGeolocationManagerProxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,51 +32,68 @@ namespace WebKit { +const char* WebGeolocationManagerProxy::supplementName() +{ + return "WebGeolocationManagerProxy"; +} + PassRefPtr<WebGeolocationManagerProxy> WebGeolocationManagerProxy::create(WebContext* context) { return adoptRef(new WebGeolocationManagerProxy(context)); } WebGeolocationManagerProxy::WebGeolocationManagerProxy(WebContext* context) - : m_isUpdating(false) - , m_context(context) + : WebContextSupplement(context) + , m_isUpdating(false) { - m_context->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), this); + WebContextSupplement::context()->addMessageReceiver(Messages::WebGeolocationManagerProxy::messageReceiverName(), this); } WebGeolocationManagerProxy::~WebGeolocationManagerProxy() { } -void WebGeolocationManagerProxy::invalidate() +void WebGeolocationManagerProxy::initializeProvider(const WKGeolocationProvider* provider) +{ + m_provider.initialize(provider); +} + +// WebContextSupplement + +void WebGeolocationManagerProxy::contextDestroyed() { stopUpdating(); } -void WebGeolocationManagerProxy::initializeProvider(const WKGeolocationProvider* provider) +void WebGeolocationManagerProxy::processDidClose(WebProcessProxy*) { - m_provider.initialize(provider); + stopUpdating(); } -void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) +void WebGeolocationManagerProxy::refWebContextSupplement() { - if (!m_context) - return; + APIObject::ref(); +} - m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data())); +void WebGeolocationManagerProxy::derefWebContextSupplement() +{ + APIObject::deref(); } -void WebGeolocationManagerProxy::providerDidFailToDeterminePosition(const String& errorMessage) +void WebGeolocationManagerProxy::providerDidChangePosition(WebGeolocationPosition* position) { - if (!m_context) + if (!context()) return; - m_context->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage)); + context()->sendToAllProcesses(Messages::WebGeolocationManager::DidChangePosition(position->data())); } -void WebGeolocationManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void WebGeolocationManagerProxy::providerDidFailToDeterminePosition(const String& errorMessage) { - didReceiveWebGeolocationManagerProxyMessage(connection, messageID, decoder); + if (!context()) + return; + + context()->sendToAllProcesses(Messages::WebGeolocationManager::DidFailToDeterminePosition(errorMessage)); } void WebGeolocationManagerProxy::startUpdating() |