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

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

Issue 441883003: Simplify Android geolocation permission checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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 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_GEOLOCATION_PERMISSION_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ 6 #define CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // GeolocationPermissionContext implementation: 68 // GeolocationPermissionContext implementation:
69 // Decide whether the geolocation permission should be granted. 69 // Decide whether the geolocation permission should be granted.
70 // Calls PermissionDecided if permission can be decided non-interactively, 70 // Calls PermissionDecided if permission can be decided non-interactively,
71 // or NotifyPermissionSet if permission decided by presenting an 71 // or NotifyPermissionSet if permission decided by presenting an
72 // infobar to the user. Called on the UI thread. 72 // infobar to the user. Called on the UI thread.
73 virtual void DecidePermission(content::WebContents* web_contents, 73 virtual void DecidePermission(content::WebContents* web_contents,
74 const PermissionRequestID& id, 74 const PermissionRequestID& id,
75 const GURL& requesting_frame, 75 const GURL& requesting_frame,
76 bool user_gesture, 76 bool user_gesture,
77 const GURL& embedder, 77 const GURL& embedder,
78 const std::string& accept_button_label,
79 base::Callback<void(bool)> callback); 78 base::Callback<void(bool)> callback);
80 79
81 // Called when permission is granted without interactively asking 80 // Called when permission is granted without interactively asking
82 // the user. Can be overridden to introduce additional UI flow. 81 // the user. Can be overridden to introduce additional UI flow.
83 // Should ultimately ensure that NotifyPermissionSet is called. 82 // Should ultimately ensure that NotifyPermissionSet is called.
84 // Called on the UI thread. 83 // Called on the UI thread.
85 virtual void PermissionDecided(const PermissionRequestID& id, 84 virtual void PermissionDecided(const PermissionRequestID& id,
86 const GURL& requesting_frame, 85 const GURL& requesting_frame,
87 const GURL& embedder, 86 const GURL& embedder,
88 base::Callback<void(bool)> callback, 87 base::Callback<void(bool)> callback,
89 bool allowed); 88 bool allowed);
90 89
91 // Create an PermissionQueueController. overriden in derived classes to 90 // Create an PermissionQueueController. overriden in derived classes to
92 // provide additional UI flow. Called on the UI thread. 91 // provide additional UI flow. Called on the UI thread.
93 virtual PermissionQueueController* CreateQueueController(); 92 virtual PermissionQueueController* CreateQueueController();
94 93
95 private: 94 private:
96 friend class base::RefCountedThreadSafe<GeolocationPermissionContext>; 95 friend class base::RefCountedThreadSafe<GeolocationPermissionContext>;
97 friend class GeolocationPermissionRequest; 96 friend class GeolocationPermissionRequest;
98 97
99 // Removes any pending InfoBar request. 98 // Removes any pending InfoBar request.
100 void CancelPendingInfobarRequest(const PermissionRequestID& id); 99 void CancelPendingInfobarRequest(const PermissionRequestID& id);
101 100
102 // Creates and show an info bar. 101 // Creates and show an info bar.
103 void CreateInfoBarRequest(const PermissionRequestID& id, 102 void CreateInfoBarRequest(const PermissionRequestID& id,
104 const GURL& requesting_frame, 103 const GURL& requesting_frame,
105 const GURL& embedder, 104 const GURL& embedder,
106 const std::string accept_button_label,
107 base::Callback<void(bool)> callback); 105 base::Callback<void(bool)> callback);
108 106
109 // Notify the context that a particular request object is no longer needed. 107 // Notify the context that a particular request object is no longer needed.
110 void RequestFinished(GeolocationPermissionRequest* request); 108 void RequestFinished(GeolocationPermissionRequest* request);
111 109
112 // These must only be accessed from the UI thread. 110 // These must only be accessed from the UI thread.
113 Profile* const profile_; 111 Profile* const profile_;
114 bool shutting_down_; 112 bool shutting_down_;
115 scoped_ptr<PermissionQueueController> permission_queue_controller_; 113 scoped_ptr<PermissionQueueController> permission_queue_controller_;
116 GeolocationPermissionContextExtensions extensions_context_; 114 GeolocationPermissionContextExtensions extensions_context_;
117 115
118 base::ScopedPtrHashMap<std::string, GeolocationPermissionRequest> 116 base::ScopedPtrHashMap<std::string, GeolocationPermissionRequest>
119 pending_requests_; 117 pending_requests_;
120 118
121 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext); 119 DISALLOW_COPY_AND_ASSIGN(GeolocationPermissionContext);
122 }; 120 };
123 121
124 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_ 122 #endif // CHROME_BROWSER_GEOLOCATION_GEOLOCATION_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698