Chromium Code Reviews| Index: chrome/browser/geolocation/geolocation_dispatcher_host.cc |
| diff --git a/chrome/browser/geolocation/geolocation_dispatcher_host_old.cc b/chrome/browser/geolocation/geolocation_dispatcher_host.cc |
| similarity index 85% |
| rename from chrome/browser/geolocation/geolocation_dispatcher_host_old.cc |
| rename to chrome/browser/geolocation/geolocation_dispatcher_host.cc |
| index 0af76e046adad9518675e63caa262df50ab412bb..8fab3c5cd66f0bcb1fa0b6ef7ba711788ca534e2 100644 |
| --- a/chrome/browser/geolocation/geolocation_dispatcher_host_old.cc |
| +++ b/chrome/browser/geolocation/geolocation_dispatcher_host.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/geolocation/geolocation_dispatcher_host_old.h" |
| +#include "chrome/browser/geolocation/geolocation_dispatcher_host.h" |
| #include <map> |
| #include <set> |
| @@ -19,14 +19,14 @@ |
| #include "ipc/ipc_message.h" |
| namespace { |
| -class GeolocationDispatcherHostOldImpl : public GeolocationDispatcherHostOld, |
| - public GeolocationObserver { |
| +class GeolocationDispatcherHostImpl : public GeolocationDispatcherHost, |
| + public GeolocationObserver { |
| public: |
| - GeolocationDispatcherHostOldImpl( |
| + GeolocationDispatcherHostImpl( |
| int resource_message_filter_process_id, |
| GeolocationPermissionContext* geolocation_permission_context); |
| - // GeolocationDispatcherHostOld |
| + // GeolocationDispatcherHost |
| // Called to possibly handle the incoming IPC message. Returns true if |
| // handled. Called in the browser process. |
|
bulach
2010/12/13 14:49:50
ditto
|
| virtual bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); |
| @@ -35,8 +35,7 @@ class GeolocationDispatcherHostOldImpl : public GeolocationDispatcherHostOld, |
| virtual void OnLocationUpdate(const Geoposition& position); |
| private: |
| - friend class base::RefCountedThreadSafe<GeolocationDispatcherHostOldImpl>; |
| - virtual ~GeolocationDispatcherHostOldImpl(); |
| + virtual ~GeolocationDispatcherHostImpl(); |
| void OnRegisterDispatcher(int render_view_id); |
| void OnUnregisterDispatcher(int render_view_id); |
| @@ -70,10 +69,10 @@ class GeolocationDispatcherHostOldImpl : public GeolocationDispatcherHostOld, |
| // Only set whilst we are registered with the arbitrator. |
| GeolocationProvider* location_provider_; |
| - DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHostOldImpl); |
| + DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHostImpl); |
| }; |
| -GeolocationDispatcherHostOldImpl::GeolocationDispatcherHostOldImpl( |
| +GeolocationDispatcherHostImpl::GeolocationDispatcherHostImpl( |
| int resource_message_filter_process_id, |
| GeolocationPermissionContext* geolocation_permission_context) |
| : resource_message_filter_process_id_(resource_message_filter_process_id), |
| @@ -84,17 +83,17 @@ GeolocationDispatcherHostOldImpl::GeolocationDispatcherHostOldImpl( |
| // a javascript geolocation object is actually initialized. |
| } |
| -GeolocationDispatcherHostOldImpl::~GeolocationDispatcherHostOldImpl() { |
| +GeolocationDispatcherHostImpl::~GeolocationDispatcherHostImpl() { |
| if (location_provider_) |
| location_provider_->RemoveObserver(this); |
| } |
| -bool GeolocationDispatcherHostOldImpl::OnMessageReceived( |
| +bool GeolocationDispatcherHostImpl::OnMessageReceived( |
| const IPC::Message& msg, bool* msg_was_ok) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| *msg_was_ok = true; |
| bool handled = true; |
| - IPC_BEGIN_MESSAGE_MAP_EX(GeolocationDispatcherHostOldImpl, msg, *msg_was_ok) |
| + IPC_BEGIN_MESSAGE_MAP_EX(GeolocationDispatcherHostImpl, msg, *msg_was_ok) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_RegisterDispatcher, |
| OnRegisterDispatcher) |
| IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_UnregisterDispatcher, |
| @@ -116,7 +115,7 @@ bool GeolocationDispatcherHostOldImpl::OnMessageReceived( |
| return handled; |
| } |
| -void GeolocationDispatcherHostOldImpl::OnLocationUpdate( |
| +void GeolocationDispatcherHostImpl::OnLocationUpdate( |
| const Geoposition& geoposition) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| for (std::set<int>::iterator it = geolocation_renderer_ids_.begin(); |
| @@ -128,21 +127,21 @@ void GeolocationDispatcherHostOldImpl::OnLocationUpdate( |
| } |
| } |
| -void GeolocationDispatcherHostOldImpl::OnRegisterDispatcher( |
| +void GeolocationDispatcherHostImpl::OnRegisterDispatcher( |
| int render_view_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| DCHECK_EQ(0u, geolocation_renderer_ids_.count(render_view_id)); |
| geolocation_renderer_ids_.insert(render_view_id); |
| } |
| -void GeolocationDispatcherHostOldImpl::OnUnregisterDispatcher( |
| +void GeolocationDispatcherHostImpl::OnUnregisterDispatcher( |
| int render_view_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| DCHECK_EQ(1u, geolocation_renderer_ids_.count(render_view_id)); |
| geolocation_renderer_ids_.erase(render_view_id); |
| } |
| -void GeolocationDispatcherHostOldImpl::OnRequestPermission( |
| +void GeolocationDispatcherHostImpl::OnRequestPermission( |
| int render_view_id, |
| int bridge_id, |
| const GURL& requesting_frame) { |
| @@ -154,7 +153,7 @@ void GeolocationDispatcherHostOldImpl::OnRequestPermission( |
| requesting_frame); |
| } |
| -void GeolocationDispatcherHostOldImpl::OnCancelPermissionRequest( |
| +void GeolocationDispatcherHostImpl::OnCancelPermissionRequest( |
| int render_view_id, |
| int bridge_id, |
| const GURL& requesting_frame) { |
| @@ -166,11 +165,14 @@ void GeolocationDispatcherHostOldImpl::OnCancelPermissionRequest( |
| requesting_frame); |
| } |
| -void GeolocationDispatcherHostOldImpl::OnStartUpdating( |
| +void GeolocationDispatcherHostImpl::OnStartUpdating( |
| int render_view_id, |
| int bridge_id, |
| const GURL& requesting_frame, |
| bool enable_high_accuracy) { |
| +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| + OnRegisterDispatcher(render_view_id); |
| +#endif |
| // WebKit sends the startupdating request before checking permissions, to |
| // optimize the no-location-available case and reduce latency in the success |
| // case (location lookup happens in parallel with the permission request). |
| @@ -185,7 +187,7 @@ void GeolocationDispatcherHostOldImpl::OnStartUpdating( |
| RefreshGeolocationObserverOptions(); |
| } |
| -void GeolocationDispatcherHostOldImpl::OnStopUpdating(int render_view_id, |
| +void GeolocationDispatcherHostImpl::OnStopUpdating(int render_view_id, |
| int bridge_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| DVLOG(1) << __FUNCTION__ << " " << resource_message_filter_process_id_ << ":" |
| @@ -194,9 +196,12 @@ void GeolocationDispatcherHostOldImpl::OnStopUpdating(int render_view_id, |
| RefreshGeolocationObserverOptions(); |
| geolocation_permission_context_->StopUpdatingRequested( |
| resource_message_filter_process_id_, render_view_id, bridge_id); |
| +#if defined(ENABLE_CLIENT_BASED_GEOLOCATION) |
| + OnUnregisterDispatcher(render_view_id); |
| +#endif |
| } |
| -void GeolocationDispatcherHostOldImpl::OnSuspend(int render_view_id, |
| +void GeolocationDispatcherHostImpl::OnSuspend(int render_view_id, |
| int bridge_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| DVLOG(1) << __FUNCTION__ << " " << resource_message_filter_process_id_ << ":" |
| @@ -204,7 +209,7 @@ void GeolocationDispatcherHostOldImpl::OnSuspend(int render_view_id, |
| // TODO(bulach): connect this with GeolocationArbitrator. |
| } |
| -void GeolocationDispatcherHostOldImpl::OnResume(int render_view_id, |
| +void GeolocationDispatcherHostImpl::OnResume(int render_view_id, |
| int bridge_id) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| DVLOG(1) << __FUNCTION__ << " " << resource_message_filter_process_id_ << ":" |
| @@ -212,7 +217,7 @@ void GeolocationDispatcherHostOldImpl::OnResume(int render_view_id, |
| // TODO(bulach): connect this with GeolocationArbitrator. |
| } |
| -void GeolocationDispatcherHostOldImpl::RefreshGeolocationObserverOptions() { |
| +void GeolocationDispatcherHostImpl::RefreshGeolocationObserverOptions() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| if (bridge_update_options_.empty()) { |
| if (location_provider_) { |
| @@ -230,10 +235,10 @@ void GeolocationDispatcherHostOldImpl::RefreshGeolocationObserverOptions() { |
| } |
| } // namespace |
| -GeolocationDispatcherHostOld* GeolocationDispatcherHostOld::New( |
| +GeolocationDispatcherHost* GeolocationDispatcherHost::New( |
| int resource_message_filter_process_id, |
| GeolocationPermissionContext* geolocation_permission_context) { |
| - return new GeolocationDispatcherHostOldImpl( |
| + return new GeolocationDispatcherHostImpl( |
| resource_message_filter_process_id, |
| geolocation_permission_context); |
| } |