diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 10:13:24 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-06 10:13:24 +0000 |
commit | 4a09a68d5845f468afcb4e383d5977ea06767054 (patch) | |
tree | 134d02256d39f51368be28ffb6fae553007ada49 /chrome/renderer | |
parent | 8e645282c61034ce50f99da02e8ed1038da866e8 (diff) | |
download | chromium_src-4a09a68d5845f468afcb4e383d5977ea06767054.zip chromium_src-4a09a68d5845f468afcb4e383d5977ea06767054.tar.gz chromium_src-4a09a68d5845f468afcb4e383d5977ea06767054.tar.bz2 |
Remove legacy non-client-based geolocation code.
BUG=59907
Review URL: http://codereview.chromium.org/5938002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/geolocation_dispatcher.cc | 4 | ||||
-rw-r--r-- | chrome/renderer/geolocation_dispatcher.h | 5 | ||||
-rw-r--r-- | chrome/renderer/geolocation_dispatcher_old.cc | 116 | ||||
-rw-r--r-- | chrome/renderer/geolocation_dispatcher_old.h | 68 | ||||
-rw-r--r-- | chrome/renderer/render_view.cc | 21 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 9 |
6 files changed, 2 insertions, 221 deletions
diff --git a/chrome/renderer/geolocation_dispatcher.cc b/chrome/renderer/geolocation_dispatcher.cc index cd49ea8..daf0856 100644 --- a/chrome/renderer/geolocation_dispatcher.cc +++ b/chrome/renderer/geolocation_dispatcher.cc @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) - #include "chrome/renderer/geolocation_dispatcher.h" #include "chrome/renderer/render_view.h" @@ -151,5 +149,3 @@ void GeolocationDispatcher::OnGeolocationPositionUpdated( code, WebKit::WebString::fromUTF8(geoposition.error_message))); } } - -#endif // CLIENT_BASED_GEOLOCATION diff --git a/chrome/renderer/geolocation_dispatcher.h b/chrome/renderer/geolocation_dispatcher.h index 91c92a8..846e8e8 100644 --- a/chrome/renderer/geolocation_dispatcher.h +++ b/chrome/renderer/geolocation_dispatcher.h @@ -6,8 +6,6 @@ #define CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ #pragma once -#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) - #include "base/scoped_ptr.h" #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebGeolocationController.h" @@ -70,6 +68,5 @@ class GeolocationDispatcher : public WebKit::WebGeolocationClient { bool enable_high_accuracy_; bool updating_; }; -#endif // ENABLE_CLIENT_BASED_GEOLOCATION -#endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ +#endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_H_ diff --git a/chrome/renderer/geolocation_dispatcher_old.cc b/chrome/renderer/geolocation_dispatcher_old.cc deleted file mode 100644 index 4a235c7..0000000 --- a/chrome/renderer/geolocation_dispatcher_old.cc +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) -#include "chrome/renderer/geolocation_dispatcher_old.h" -#include "base/command_line.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/renderer/render_view.h" -#include "third_party/WebKit/WebKit/chromium/public/WebCString.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" -#include "third_party/WebKit/WebKit/chromium/public/WebGeolocationServiceBridge.h" - -using WebKit::WebFrame; - -GeolocationDispatcherOld::GeolocationDispatcherOld(RenderView* render_view) - : render_view_(render_view) { - render_view_->Send(new ViewHostMsg_Geolocation_RegisterDispatcher( - render_view_->routing_id())); -} - -GeolocationDispatcherOld::~GeolocationDispatcherOld() { - for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_); - !it.IsAtEnd(); it.Advance()) { - it.GetCurrentValue()->onWebGeolocationServiceDestroyed(); - } - render_view_->Send(new ViewHostMsg_Geolocation_UnregisterDispatcher( - render_view_->routing_id())); -} - -bool GeolocationDispatcherOld::OnMessageReceived(const IPC::Message& message) { - bool handled = true; - IPC_BEGIN_MESSAGE_MAP(GeolocationDispatcherOld, message) - IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PermissionSet, - OnGeolocationPermissionSet) - IPC_MESSAGE_HANDLER(ViewMsg_Geolocation_PositionUpdated, - OnGeolocationPositionUpdated) - IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP() - return handled; -} - -void GeolocationDispatcherOld::requestPermissionForFrame( - int bridge_id, const WebKit::WebURL& url) { - render_view_->Send(new ViewHostMsg_Geolocation_RequestPermission( - render_view_->routing_id(), bridge_id, GURL(url))); -} - -void GeolocationDispatcherOld::cancelPermissionRequestForFrame( - int bridge_id, const WebKit::WebURL& url) { - render_view_->Send(new ViewHostMsg_Geolocation_CancelPermissionRequest( - render_view_->routing_id(), bridge_id, GURL(url))); -} - -void GeolocationDispatcherOld::startUpdating( - int bridge_id, const WebKit::WebURL& url, bool enableHighAccuracy) { - render_view_->Send(new ViewHostMsg_Geolocation_StartUpdating( - render_view_->routing_id(), bridge_id, GURL(url), - enableHighAccuracy)); -} - -void GeolocationDispatcherOld::stopUpdating(int bridge_id) { - render_view_->Send(new ViewHostMsg_Geolocation_StopUpdating( - render_view_->routing_id(), bridge_id)); -} - -void GeolocationDispatcherOld::suspend(int bridge_id) { - render_view_->Send(new ViewHostMsg_Geolocation_Suspend( - render_view_->routing_id(), bridge_id)); -} - -void GeolocationDispatcherOld::resume(int bridge_id) { - render_view_->Send(new ViewHostMsg_Geolocation_Resume( - render_view_->routing_id(), bridge_id)); -} - -int GeolocationDispatcherOld::attachBridge( - WebKit::WebGeolocationServiceBridge* bridge) { - return bridges_map_.Add(bridge); -} - -void GeolocationDispatcherOld::detachBridge(int bridge_id) { - bridges_map_.Remove(bridge_id); -} - -void GeolocationDispatcherOld::OnGeolocationPermissionSet(int bridge_id, - bool allowed) { - WebKit::WebGeolocationServiceBridge* bridge = bridges_map_.Lookup(bridge_id); - if (bridge) { - bridge->setIsAllowed(allowed); - } -} - -void GeolocationDispatcherOld::OnGeolocationPositionUpdated( - const Geoposition& geoposition) { - DCHECK(geoposition.IsInitialized()); - for (IDMap<WebKit::WebGeolocationServiceBridge>::iterator it(&bridges_map_); - !it.IsAtEnd(); it.Advance()) { - if (geoposition.IsValidFix()) { - it.GetCurrentValue()->setLastPosition( - geoposition.latitude, geoposition.longitude, - geoposition.is_valid_altitude(), geoposition.altitude, - geoposition.accuracy, - geoposition.is_valid_altitude_accuracy(), - geoposition.altitude_accuracy, - geoposition.is_valid_heading(), geoposition.heading, - geoposition.is_valid_speed(), geoposition.speed, - static_cast<int64>(geoposition.timestamp.ToDoubleT() * 1000)); - } else { - it.GetCurrentValue()->setLastError( - geoposition.error_code, - WebKit::WebString::fromUTF8(geoposition.error_message)); - } - } -} -#endif // !ENABLE_CLIENT_BASED_GEOLOCATION diff --git a/chrome/renderer/geolocation_dispatcher_old.h b/chrome/renderer/geolocation_dispatcher_old.h deleted file mode 100644 index ab93c14..0000000 --- a/chrome/renderer/geolocation_dispatcher_old.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_RENDERER_GEOLOCATION_DISPATCHER_OLD_H_ -#define CHROME_RENDERER_GEOLOCATION_DISPATCHER_OLD_H_ -#pragma once - -#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION) -// TODO(jknotten): Remove this class once the new client-based implementation is -// checked in (see http://crbug.com/59908). - -#include "base/basictypes.h" -#include "base/id_map.h" -#include "ipc/ipc_channel.h" -#include "googleurl/src/gurl.h" -#include "third_party/WebKit/WebKit/chromium/public/WebGeolocationService.h" - -class GURL; -class RenderView; -struct Geoposition; - -// GeolocationDispatcherOld is a delegate for Geolocation messages used by -// WebKit. -// It's the complement of GeolocationDispatcherHostOld (owned by -// RenderViewHost). - -class GeolocationDispatcherOld : public WebKit::WebGeolocationService, - public IPC::Channel::Listener { - public: - explicit GeolocationDispatcherOld(RenderView* render_view); - virtual ~GeolocationDispatcherOld(); - - // IPC::Channel::Listener implementation - bool OnMessageReceived(const IPC::Message& msg); - - // WebKit::WebGeolocationService. - virtual void requestPermissionForFrame(int bridge_id, - const WebKit::WebURL& url); - virtual void cancelPermissionRequestForFrame( - int bridge_id, const WebKit::WebURL& url); - virtual void startUpdating( - int bridge_id, const WebKit::WebURL& url, bool enableHighAccuracy); - virtual void stopUpdating(int bridge_id); - virtual void suspend(int bridge_id); - virtual void resume(int bridge_id); - virtual int attachBridge( - WebKit::WebGeolocationServiceBridge* geolocation_service); - virtual void detachBridge(int bridge_id); - - private: - // Permission for using geolocation has been set. - void OnGeolocationPermissionSet(int bridge_id, bool is_allowed); - - // We have an updated geolocation position or error code. - void OnGeolocationPositionUpdated(const Geoposition& geoposition); - - RenderView* render_view_; - - // The geolocation services attached to this dispatcher. - IDMap<WebKit::WebGeolocationServiceBridge> bridges_map_; - - DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherOld); -}; - -#endif // ENABLE_CLIENT_BASED_GEOLOCATION - -#endif // CHROME_RENDERER_GEOLOCATION_DISPATCHER_OLD_H_ diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 6f97958..fc08d7f 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -63,11 +63,7 @@ #include "chrome/renderer/extensions/renderer_extension_bindings.h" #include "chrome/renderer/external_host_bindings.h" #include "chrome/renderer/external_popup_menu.h" -#if ENABLE_CLIENT_BASED_GEOLOCATION #include "chrome/renderer/geolocation_dispatcher.h" -#else -#include "chrome/renderer/geolocation_dispatcher_old.h" -#endif #include "chrome/renderer/ggl/ggl.h" #include "chrome/renderer/load_progress_tracker.h" #include "chrome/renderer/localized_error.h" @@ -5636,26 +5632,9 @@ void RenderView::OnPageTranslated() { } WebKit::WebGeolocationClient* RenderView::geolocationClient() { -#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) if (!geolocation_dispatcher_.get()) geolocation_dispatcher_.reset(new GeolocationDispatcher(this)); return geolocation_dispatcher_.get(); -#else - // TODO(jknotten): Remove once building with ENABLE_CLIENT_BASED_GEOLOCATION. - NOTREACHED(); - return 0; -#endif -} - -WebKit::WebGeolocationService* RenderView::geolocationService() { -#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) - NOTREACHED(); - return 0; -#else - if (!geolocation_dispatcher_.get()) - geolocation_dispatcher_.reset(new GeolocationDispatcherOld(this)); - return geolocation_dispatcher_.get(); -#endif } WebKit::WebSpeechInputController* RenderView::speechInputController( diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index 4e8d0aa..897a964 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -497,9 +497,7 @@ class RenderView : public RenderWidget, virtual void didClearAutoFillSelection(const WebKit::WebNode& node); virtual void didAcceptAutocompleteSuggestion( const WebKit::WebInputElement& element); - // TODO(jknotten): Remove once building with ENABLE_CLIENT_BASED_GEOLOCATION. virtual WebKit::WebGeolocationClient* geolocationClient(); - virtual WebKit::WebGeolocationService* geolocationService(); virtual WebKit::WebSpeechInputController* speechInputController( WebKit::WebSpeechInputListener* listener); virtual WebKit::WebDeviceOrientationClient* deviceOrientationClient(); @@ -1394,13 +1392,8 @@ class RenderView : public RenderWidget, scoped_refptr<AudioMessageFilter> audio_message_filter_; -#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) - // the geolocation dispatcher attached to this view, lazily initialized. + // The geolocation dispatcher attached to this view, lazily initialized. scoped_ptr<GeolocationDispatcher> geolocation_dispatcher_; -#else - // TODO(jknotten): Remove once building with ENABLE_CLIENT_BASED_GEOLOCATION. - scoped_ptr<GeolocationDispatcherOld> geolocation_dispatcher_; -#endif // Handles accessibility requests into the renderer side, as well as // maintains the cache and other features of the accessibility tree. |