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

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

Issue 625963003: Do not send IPC message to cancel Geolocation permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments + rebase Created 6 years, 2 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
« no previous file with comments | « no previous file | content/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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:
45 // TODO(mlamouri): |requesting_origin| should be a security origin to
46 // guarantee that a proper origin is passed.
42 void OnRequestPermission(RenderFrameHost* render_frame_host, 47 void OnRequestPermission(RenderFrameHost* render_frame_host,
43 int bridge_id, 48 int bridge_id,
44 const GURL& requesting_frame, 49 const GURL& requesting_origin,
45 bool user_gesture); 50 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, 51 void OnStartUpdating(RenderFrameHost* render_frame_host,
50 const GURL& requesting_frame, 52 const GURL& requesting_origin,
51 bool enable_high_accuracy); 53 bool enable_high_accuracy);
52 void OnStopUpdating(RenderFrameHost* render_frame_host); 54 void OnStopUpdating(RenderFrameHost* render_frame_host);
53 55
54 // Updates the geolocation provider with the currently required update 56 // Updates the geolocation provider with the currently required update
55 // options. 57 // options.
56 void RefreshGeolocationOptions(); 58 void RefreshGeolocationOptions();
57 59
58 void OnLocationUpdate(const Geoposition& position); 60 void OnLocationUpdate(const Geoposition& position);
59 61
60 void SendGeolocationPermissionResponse(int render_process_id, 62 void SendGeolocationPermissionResponse(int render_process_id,
61 int render_frame_id, 63 int render_frame_id,
62 int bridge_id, 64 int bridge_id,
63 bool allowed); 65 bool allowed);
64 66
67 // Clear pending permissions associated with a given frame and request the
68 // browser to cancel the permission requests.
69 void CancelPermissionRequestsForFrame(RenderFrameHost* render_frame_host);
70
65 // A map from the RenderFrameHosts that have requested geolocation updates to 71 // A map from the RenderFrameHosts that have requested geolocation updates to
66 // the type of accuracy they requested (true = high accuracy). 72 // the type of accuracy they requested (true = high accuracy).
67 std::map<RenderFrameHost*, bool> updating_frames_; 73 std::map<RenderFrameHost*, bool> updating_frames_;
68 bool paused_; 74 bool paused_;
69 75
70 struct PendingPermission { 76 struct PendingPermission {
71 PendingPermission(int render_frame_id, 77 PendingPermission(int render_frame_id,
72 int render_process_id, 78 int render_process_id,
73 int bridge_id); 79 int bridge_id,
80 const GURL& origin);
74 ~PendingPermission(); 81 ~PendingPermission();
75 int render_frame_id; 82 int render_frame_id;
76 int render_process_id; 83 int render_process_id;
77 int bridge_id; 84 int bridge_id;
85 GURL origin;
78 }; 86 };
79 std::vector<PendingPermission> pending_permissions_; 87 std::vector<PendingPermission> pending_permissions_;
80 88
81 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; 89 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_;
82 90
83 base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_; 91 base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_;
84 92
85 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost); 93 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost);
86 }; 94 };
87 95
88 } // namespace content 96 } // namespace content
89 97
90 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ 98 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
OLDNEW
« 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