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

Unified Diff: chrome/browser/guestview/webview/webview_guest.h

Issue 21297005: <webview>: Refactor Permission API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_permissions
Patch Set: Cleanup Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guestview/webview/webview_guest.h
diff --git a/chrome/browser/guestview/webview/webview_guest.h b/chrome/browser/guestview/webview/webview_guest.h
index a9abd6873bac09ab70f52e8a56ca8aef74fbabcb..94f85f99aa32e4dc68bfb2e129f87c9e72c1cd37 100644
--- a/chrome/browser/guestview/webview/webview_guest.h
+++ b/chrome/browser/guestview/webview/webview_guest.h
@@ -49,6 +49,10 @@ class WebViewGuest : public GuestView,
const content::NativeWebKeyboardEvent& event) OVERRIDE;
virtual void RendererResponsive() OVERRIDE;
virtual void RendererUnresponsive() OVERRIDE;
+ virtual bool RequestPermission(
+ BrowserPluginPermissionType permission_type,
+ const base::DictionaryValue& request_info,
+ const PermissionResponseCallback& callback) OVERRIDE;
// NotificationObserver implementation.
virtual void Observe(int type,
@@ -62,6 +66,13 @@ class WebViewGuest : public GuestView,
// Reload the guest.
void Reload();
+ // Responds to the permission request |request_id| with |should_allow| and
+ // |user_input|. Returns whether there was a pending request for the provided
+ // |request_id|.
+ bool SetPermission(int request_id,
+ bool should_allow,
+ const std::string& user_input);
+
// Stop loading the guest.
void Stop();
@@ -120,6 +131,14 @@ class WebViewGuest : public GuestView,
content::NotificationRegistrar notification_registrar_;
+ // A counter to generate a unique request id for a permission request.
+ // We only need the ids to be unique for a given WebViewGuest.
+ int next_permission_request_id_;
+
+ // A map to store the callback for a request keyed by the request's id.
+ typedef std::map<int, PermissionResponseCallback> RequestMap;
+ RequestMap pending_permission_requests_;
+
DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
};

Powered by Google App Engine
This is Rietveld 408576698