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

Unified Diff: android_webview/native/permission/permission_request_handler.h

Issue 288463003: Cancel the permission request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix unittests 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/native/permission/permission_request_handler.h
diff --git a/android_webview/native/permission/permission_request_handler.h b/android_webview/native/permission/permission_request_handler.h
index 3acb497654edca30f9396b8cd1e79663f6b4a367..69a9171169dbea13262c166a826a52795990226a 100644
--- a/android_webview/native/permission/permission_request_handler.h
+++ b/android_webview/native/permission/permission_request_handler.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
#include "url/gurl.h"
namespace android_webview {
@@ -22,9 +23,10 @@ class PermissionRequestHandlerClient;
// requests.
// It is owned by AwContents and has 1x1 mapping to AwContents. All methods
// are running on UI thread.
-class PermissionRequestHandler {
+class PermissionRequestHandler : public content::WebContentsObserver {
public:
- PermissionRequestHandler(PermissionRequestHandlerClient* aw_contents);
+ PermissionRequestHandler(PermissionRequestHandlerClient* client,
+ content::WebContents* aw_contents);
virtual ~PermissionRequestHandler();
// Send the given |request| to PermissionRequestHandlerClient.
@@ -36,6 +38,10 @@ class PermissionRequestHandler {
// Allow |origin| to access the |resources|.
void PreauthorizePermission(const GURL& origin, int64 resources);
+ // WebContentsObserver
+ virtual void NavigationEntryCommitted(
+ const content::LoadCommittedDetails& load_details) OVERRIDE;
+
private:
friend class TestPermissionRequestHandler;
@@ -48,6 +54,8 @@ class PermissionRequestHandler {
// Cancel the given request.
void CancelRequest(RequestIterator i);
+ void CancelAllRequests();
+
// Remove the invalid requests from requests_.
void PruneRequests();
@@ -61,6 +69,10 @@ class PermissionRequestHandler {
std::map<std::string, int64> preauthorized_permission_;
+ // The unique id of the active NavigationEntry of the WebContents that we were
+ // opened for. Used to help expire on requests.
+ int contents_unique_id_;
+
DISALLOW_COPY_AND_ASSIGN(PermissionRequestHandler);
};
« no previous file with comments | « android_webview/native/aw_contents.cc ('k') | android_webview/native/permission/permission_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698