OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... | |
28 // If the web contents is paused while not currently using geolocation but | 28 // If the web contents is paused while not currently using geolocation but |
29 // then goes on to do so before being resumed, then it will not get | 29 // then goes on to do so before being resumed, then it will not get |
30 // geolocation updates until it is resumed. | 30 // geolocation updates until it is resumed. |
31 void PauseOrResume(bool should_pause); | 31 void PauseOrResume(bool should_pause); |
32 | 32 |
33 private: | 33 private: |
34 // WebContentsObserver | 34 // WebContentsObserver |
35 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; | 35 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; |
36 virtual void RenderViewHostChanged(RenderViewHost* old_host, | 36 virtual void RenderViewHostChanged(RenderViewHost* old_host, |
37 RenderViewHost* new_host) OVERRIDE; | 37 RenderViewHost* new_host) OVERRIDE; |
38 virtual void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, | |
39 const LoadCommittedDetails& details, | |
40 const FrameNavigateParams& params) OVERRIDE; | |
38 virtual bool OnMessageReceived( | 41 virtual bool OnMessageReceived( |
39 const IPC::Message& msg, RenderFrameHost* render_frame_host) OVERRIDE; | 42 const IPC::Message& msg, RenderFrameHost* render_frame_host) OVERRIDE; |
40 | 43 |
41 // Message handlers: | 44 // Message handlers: |
42 void OnRequestPermission(RenderFrameHost* render_frame_host, | 45 void OnRequestPermission(RenderFrameHost* render_frame_host, |
43 int bridge_id, | 46 int bridge_id, |
44 const GURL& requesting_frame, | 47 const GURL& requesting_origin, |
Charlie Reis
2014/10/07 21:35:35
nit: Can you add a similar TODO as the one above G
mlamouri (slow - plz ping)
2014/10/08 09:24:33
Done.
| |
45 bool user_gesture); | 48 bool user_gesture); |
46 void OnCancelPermissionRequest(RenderFrameHost* render_frame_host, | |
47 int bridge_id, | |
48 const GURL& requesting_frame); | |
49 void OnStartUpdating(RenderFrameHost* render_frame_host, | 49 void OnStartUpdating(RenderFrameHost* render_frame_host, |
50 const GURL& requesting_frame, | 50 const GURL& requesting_origin, |
51 bool enable_high_accuracy); | 51 bool enable_high_accuracy); |
52 void OnStopUpdating(RenderFrameHost* render_frame_host); | 52 void OnStopUpdating(RenderFrameHost* render_frame_host); |
53 | 53 |
54 // Updates the geolocation provider with the currently required update | 54 // Updates the geolocation provider with the currently required update |
55 // options. | 55 // options. |
56 void RefreshGeolocationOptions(); | 56 void RefreshGeolocationOptions(); |
57 | 57 |
58 void OnLocationUpdate(const Geoposition& position); | 58 void OnLocationUpdate(const Geoposition& position); |
59 | 59 |
60 void SendGeolocationPermissionResponse(int render_process_id, | 60 void SendGeolocationPermissionResponse(int render_process_id, |
61 int render_frame_id, | 61 int render_frame_id, |
62 int bridge_id, | 62 int bridge_id, |
63 bool allowed); | 63 bool allowed); |
64 | 64 |
65 // Clear pending permissions associated with a given frame and request the | |
66 // browser to cancel the permission requests. | |
67 void CancelPermissionRequestsForFrame(RenderFrameHost* render_frame_host); | |
68 | |
65 // A map from the RenderFrameHosts that have requested geolocation updates to | 69 // A map from the RenderFrameHosts that have requested geolocation updates to |
66 // the type of accuracy they requested (true = high accuracy). | 70 // the type of accuracy they requested (true = high accuracy). |
67 std::map<RenderFrameHost*, bool> updating_frames_; | 71 std::map<RenderFrameHost*, bool> updating_frames_; |
68 bool paused_; | 72 bool paused_; |
69 | 73 |
70 struct PendingPermission { | 74 struct PendingPermission { |
71 PendingPermission(int render_frame_id, | 75 PendingPermission(int render_frame_id, |
72 int render_process_id, | 76 int render_process_id, |
73 int bridge_id); | 77 int bridge_id, |
78 const GURL& origin); | |
74 ~PendingPermission(); | 79 ~PendingPermission(); |
75 int render_frame_id; | 80 int render_frame_id; |
76 int render_process_id; | 81 int render_process_id; |
77 int bridge_id; | 82 int bridge_id; |
83 GURL origin; | |
78 }; | 84 }; |
79 std::vector<PendingPermission> pending_permissions_; | 85 std::vector<PendingPermission> pending_permissions_; |
80 | 86 |
81 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; | 87 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; |
82 | 88 |
83 base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_; | 89 base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_; |
84 | 90 |
85 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost); | 91 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost); |
86 }; | 92 }; |
87 | 93 |
88 } // namespace content | 94 } // namespace content |
89 | 95 |
90 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ | 96 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ |
OLD | NEW |