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

Side by Side Diff: chrome/browser/geolocation/geolocation_dispatcher_host.h

Issue 658005: Bring Geolocation to life!... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "chrome/browser/geolocation/location_arbitrator.h"
12 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
13 14
14 class GeolocationPermissionContext; 15 class GeolocationPermissionContext;
15 struct Geoposition;
16 class GURL; 16 class GURL;
17 class ResourceMessageFilter; 17 class ResourceMessageFilter;
18 class URLRequestContextGetter;
19 struct Geoposition;
18 20
19 // GeolocationDispatcherHost is a delegate for Geolocation messages used by 21 // GeolocationDispatcherHost is a delegate for Geolocation messages used by
20 // ResourceMessageFilter. 22 // ResourceMessageFilter.
21 // It's the complement of GeolocationDispatcher (owned by RenderView). 23 // It's the complement of GeolocationDispatcher (owned by RenderView).
22 class GeolocationDispatcherHost 24 class GeolocationDispatcherHost
23 : public base::RefCountedThreadSafe<GeolocationDispatcherHost> { 25 : public base::RefCountedThreadSafe<GeolocationDispatcherHost>,
26 public GeolocationArbitrator::Delegate {
24 public: 27 public:
25 GeolocationDispatcherHost( 28 GeolocationDispatcherHost(
26 int resource_message_filter_process_id, 29 int resource_message_filter_process_id,
27 GeolocationPermissionContext* geolocation_permission_context); 30 GeolocationPermissionContext* geolocation_permission_context);
28 31
29 // Called to possibly handle the incoming IPC message. Returns true if 32 // Called to possibly handle the incoming IPC message. Returns true if
30 // handled. Called in the browser process. 33 // handled. Called in the browser process.
31 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok); 34 bool OnMessageReceived(const IPC::Message& msg, bool* msg_was_ok);
32 35
33 // Tells the render view that a new geolocation position is available. 36 // GeolocationArbitrator::Delegate
34 void NotifyPositionUpdated(const Geoposition& geoposition); 37 virtual void OnLocationUpdate(const Geoposition& position);
35 38
36 private: 39 private:
37 friend class base::RefCountedThreadSafe<GeolocationDispatcherHost>; 40 friend class base::RefCountedThreadSafe<GeolocationDispatcherHost>;
38 ~GeolocationDispatcherHost(); 41 ~GeolocationDispatcherHost();
39 42
40 void OnRegisterDispatcher(int route_id); 43 void OnRegisterDispatcher(int route_id);
41 void OnUnregisterDispatcher(int route_id); 44 void OnUnregisterDispatcher(int route_id);
42 void OnRequestPermission(int route_id, int bridge_id, const GURL& origin); 45 void OnRequestPermission(int route_id, int bridge_id, const GURL& origin);
43 void OnStartUpdating(int route_id, int bridge_id, bool high_accuracy); 46 void OnStartUpdating(int route_id, int bridge_id, bool high_accuracy);
44 void OnStopUpdating(int route_id, int bridge_id); 47 void OnStopUpdating(int route_id, int bridge_id);
(...skipping 18 matching lines...) Expand all
63 return process_id == rhs.route_id && 66 return process_id == rhs.route_id &&
64 route_id == rhs.route_id; 67 route_id == rhs.route_id;
65 } 68 }
66 bool operator<(const GeolocationServiceRenderId& rhs) const { 69 bool operator<(const GeolocationServiceRenderId& rhs) const {
67 return process_id < rhs.route_id && 70 return process_id < rhs.route_id &&
68 route_id < rhs.route_id; 71 route_id < rhs.route_id;
69 } 72 }
70 }; 73 };
71 // Only used on the IO thread. 74 // Only used on the IO thread.
72 std::set<GeolocationServiceRenderId> geolocation_renderers_; 75 std::set<GeolocationServiceRenderId> geolocation_renderers_;
76 // Only set whilst we are registered with the arbitrator.
77 scoped_refptr<GeolocationArbitrator> location_arbitrator_;
73 78
74 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost); 79 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost);
75 }; 80 };
76 81
77 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ 82 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_browsertest.cc ('k') | chrome/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698