Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: content/browser/geolocation/geolocation_dispatcher_host.h

Issue 262753006: Merge GeolocationDispatcherHostImpl with GeolocationDispatcher. None of the other message filters h… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: reupload after revert with fix Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/geolocation/geolocation_dispatcher_host.h
===================================================================
--- content/browser/geolocation/geolocation_dispatcher_host.h (revision 267956)
+++ content/browser/geolocation/geolocation_dispatcher_host.h (working copy)
@@ -5,8 +5,14 @@
#ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
+#include <map>
+#include <set>
+
+#include "content/browser/geolocation/geolocation_provider_impl.h"
#include "content/public/browser/browser_message_filter.h"
+class GURL;
+
namespace content {
class GeolocationPermissionContext;
@@ -15,7 +21,7 @@
// It's the complement of GeolocationDispatcher (owned by RenderView).
class GeolocationDispatcherHost : public BrowserMessageFilter {
public:
- static GeolocationDispatcherHost* New(
+ GeolocationDispatcherHost(
int render_process_id,
GeolocationPermissionContext* geolocation_permission_context);
@@ -24,12 +30,62 @@
// If a renderer is paused while not currently using geolocation but
// then goes on to do so before being resumed, then that renderer will
// not get geolocation updates until it is resumed.
- virtual void PauseOrResume(int render_view_id, bool should_pause) = 0;
+ void PauseOrResume(int render_view_id, bool should_pause);
- protected:
- GeolocationDispatcherHost();
+ private:
virtual ~GeolocationDispatcherHost();
+ // GeolocationDispatcherHost
+ virtual bool OnMessageReceived(const IPC::Message& msg,
+ bool* msg_was_ok) OVERRIDE;
+
+ // Message handlers:
+ void OnRequestPermission(int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame,
+ bool user_gesture);
+ void OnCancelPermissionRequest(int render_view_id,
+ int bridge_id,
+ const GURL& requesting_frame);
+ void OnStartUpdating(int render_view_id,
+ const GURL& requesting_frame,
+ bool enable_high_accuracy);
+ void OnStopUpdating(int render_view_id);
+
+ // Updates the |geolocation_provider_| with the currently required update
+ // options.
+ void RefreshGeolocationOptions();
+
+ void OnLocationUpdate(const Geoposition& position);
+
+ int render_process_id_;
+ scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_;
+
+ struct RendererGeolocationOptions {
+ bool high_accuracy;
+ bool is_paused;
+ };
+
+ // Used to keep track of the renderers in this process that are using
+ // geolocation and the options associated with them. The map is iterated
+ // when a location update is available and the fan out to individual bridge
+ // IDs happens renderer side, in order to minimize context switches.
+ // Only used on the IO thread.
+ std::map<int, RendererGeolocationOptions> geolocation_renderers_;
+
+ // Used by Android WebView to support that case that a renderer is in the
+ // 'paused' state but not yet using geolocation. If the renderer does start
+ // using geolocation while paused, we move from this set into
+ // |geolocation_renderers_|. If the renderer doesn't end up wanting to use
+ // geolocation while 'paused' then we remove from this set. A renderer id
+ // can exist only in this set or |geolocation_renderers_|, never both.
+ std::set<int> pending_paused_geolocation_renderers_;
+
+ // Only set whilst we are registered with the geolocation provider.
+ GeolocationProviderImpl* geolocation_provider_;
+
+ GeolocationProviderImpl::LocationUpdateCallback callback_;
+
DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost);
};
« no previous file with comments | « no previous file | content/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698