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

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

Powered by Google App Engine
This is Rietveld 408576698