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

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

Issue 265773002: [Media,Geolocation] Add permission bubble cancellation. (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
« no previous file with comments | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context.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 CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ 6 #define CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
7 7
8 #include <map>
8 #include <string> 9 #include <string>
9 10
11 #include "base/containers/scoped_ptr_hash_map.h"
10 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/content_settings/permission_queue_controller.h" 13 #include "chrome/browser/content_settings/permission_queue_controller.h"
12 #include "content/public/browser/geolocation_permission_context.h" 14 #include "content/public/browser/geolocation_permission_context.h"
13 15
14 namespace content { 16 namespace content {
15 class WebContents; 17 class WebContents;
16 } 18 }
17 19
20 class GeolocationPermissionRequest;
18 class PermissionRequestID; 21 class PermissionRequestID;
19 class Profile; 22 class Profile;
20 23
21 // Chrome specific implementation of GeolocationPermissionContext; manages 24 // Chrome specific implementation of GeolocationPermissionContext; manages
22 // Geolocation permissions flow, and delegates UI handling via 25 // Geolocation permissions flow, and delegates UI handling via
23 // PermissionQueueController. 26 // PermissionQueueController.
24 class ChromeGeolocationPermissionContext 27 class ChromeGeolocationPermissionContext
25 : public content::GeolocationPermissionContext { 28 : public content::GeolocationPermissionContext {
26 public: 29 public:
27 explicit ChromeGeolocationPermissionContext(Profile* profile); 30 explicit ChromeGeolocationPermissionContext(Profile* profile);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 const GURL& requesting_frame, 83 const GURL& requesting_frame,
81 const GURL& embedder, 84 const GURL& embedder,
82 base::Callback<void(bool)> callback, 85 base::Callback<void(bool)> callback,
83 bool allowed); 86 bool allowed);
84 87
85 // Create an PermissionQueueController. overriden in derived classes to 88 // Create an PermissionQueueController. overriden in derived classes to
86 // provide additional UI flow. Called on the UI thread. 89 // provide additional UI flow. Called on the UI thread.
87 virtual PermissionQueueController* CreateQueueController(); 90 virtual PermissionQueueController* CreateQueueController();
88 91
89 private: 92 private:
93 friend class GeolocationPermissionRequest;
94
90 // Removes any pending InfoBar request. 95 // Removes any pending InfoBar request.
91 void CancelPendingInfobarRequest(const PermissionRequestID& id); 96 void CancelPendingInfobarRequest(const PermissionRequestID& id);
92 97
93 // Creates and show an info bar. 98 // Creates and show an info bar.
94 void CreateInfoBarRequest(const PermissionRequestID& id, 99 void CreateInfoBarRequest(const PermissionRequestID& id,
95 const GURL& requesting_frame, 100 const GURL& requesting_frame,
96 const GURL& embedder, 101 const GURL& embedder,
97 const std::string accept_button_label, 102 const std::string accept_button_label,
98 base::Callback<void(bool)> callback); 103 base::Callback<void(bool)> callback);
99 104
105 // Notify the context that a particular request object is no longer needed.
106 void RequestFinished(GeolocationPermissionRequest* request);
107
100 // These must only be accessed from the UI thread. 108 // These must only be accessed from the UI thread.
101 Profile* const profile_; 109 Profile* const profile_;
102 bool shutting_down_; 110 bool shutting_down_;
103 scoped_ptr<PermissionQueueController> permission_queue_controller_; 111 scoped_ptr<PermissionQueueController> permission_queue_controller_;
104 112
113 base::ScopedPtrHashMap<std::string, GeolocationPermissionRequest>
114 pending_requests_;
115
105 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext); 116 DISALLOW_COPY_AND_ASSIGN(ChromeGeolocationPermissionContext);
106 }; 117 };
107 118
108 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_ 119 #endif // CHROME_BROWSER_GEOLOCATION_CHROME_GEOLOCATION_PERMISSION_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/geolocation/chrome_geolocation_permission_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698