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

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

Issue 330143002: Simplify geolocation permission request in the Content API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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) 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 10
11 #include "base/callback_forward.h"
12 #include "base/memory/weak_ptr.h"
10 #include "content/browser/geolocation/geolocation_provider_impl.h" 13 #include "content/browser/geolocation/geolocation_provider_impl.h"
11 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
12 15
13 class GURL; 16 class GURL;
14 17
15 namespace content { 18 namespace content {
16 19
17 class GeolocationPermissionContext;
18
19 // GeolocationDispatcherHost is an observer for Geolocation messages. 20 // GeolocationDispatcherHost is an observer for Geolocation messages.
20 // It's the complement of GeolocationDispatcher (owned by RenderView). 21 // It's the complement of GeolocationDispatcher (owned by RenderView).
21 class GeolocationDispatcherHost : public WebContentsObserver { 22 class GeolocationDispatcherHost : public WebContentsObserver {
22 public: 23 public:
23 explicit GeolocationDispatcherHost(WebContents* web_contents); 24 explicit GeolocationDispatcherHost(WebContents* web_contents);
24 virtual ~GeolocationDispatcherHost(); 25 virtual ~GeolocationDispatcherHost();
25 26
26 // Pause or resumes geolocation. Resuming when nothing is paused is a no-op. 27 // Pause or resumes geolocation. Resuming when nothing is paused is a no-op.
27 // 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
28 // 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
(...skipping 20 matching lines...) Expand all
49 const GURL& requesting_frame, 50 const GURL& requesting_frame,
50 bool enable_high_accuracy); 51 bool enable_high_accuracy);
51 void OnStopUpdating(RenderFrameHost* render_frame_host); 52 void OnStopUpdating(RenderFrameHost* render_frame_host);
52 53
53 // Updates the geolocation provider with the currently required update 54 // Updates the geolocation provider with the currently required update
54 // options. 55 // options.
55 void RefreshGeolocationOptions(); 56 void RefreshGeolocationOptions();
56 57
57 void OnLocationUpdate(const Geoposition& position); 58 void OnLocationUpdate(const Geoposition& position);
58 59
59 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; 60 void SendGeolocationPermissionResponse(int render_process_id,
61 int render_frame_id,
62 int bridge_id,
63 bool allowed);
60 64
61 // A map from the RenderFrameHosts that have requested geolocation updates to 65 // A map from the RenderFrameHosts that have requested geolocation updates to
62 // the type of accuracy they requested (true = high accuracy). 66 // the type of accuracy they requested (true = high accuracy).
63 std::map<RenderFrameHost*, bool> updating_frames_; 67 std::map<RenderFrameHost*, bool> updating_frames_;
64 bool paused_; 68 bool paused_;
65 69
70 struct PendingPermission {
71 PendingPermission(int render_frame_id,
72 int render_process_id,
73 int bridge_id);
74 ~PendingPermission();
75 int render_frame_id;
76 int render_process_id;
77 int bridge_id;
78 base::Closure cancel;
79 };
80 std::vector<PendingPermission> pending_permissions_;
81
66 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_; 82 scoped_ptr<GeolocationProvider::Subscription> geolocation_subscription_;
67 83
84 base::WeakPtrFactory<GeolocationDispatcherHost> weak_factory_;
85
68 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost); 86 DISALLOW_COPY_AND_ASSIGN(GeolocationDispatcherHost);
69 }; 87 };
70 88
71 } // namespace content 89 } // namespace content
72 90
73 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_ 91 #endif // CONTENT_BROWSER_GEOLOCATION_GEOLOCATION_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl_unittest.cc ('k') | content/browser/geolocation/geolocation_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698