Chromium Code Reviews| Index: chrome/browser/guest_view/web_view/web_view_guest.h |
| diff --git a/chrome/browser/guest_view/web_view/web_view_guest.h b/chrome/browser/guest_view/web_view/web_view_guest.h |
| index 32defb5c87197e7ad491a23e44485151e5cb52e2..861b9fad2b2a870ce3f55b33406ed04004486149 100644 |
| --- a/chrome/browser/guest_view/web_view/web_view_guest.h |
| +++ b/chrome/browser/guest_view/web_view/web_view_guest.h |
| @@ -12,6 +12,7 @@ |
| #include "chrome/browser/guest_view/guest_view.h" |
| #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h" |
| #include "chrome/browser/guest_view/web_view/web_view_find_helper.h" |
| +#include "chrome/browser/guest_view/web_view/web_view_permission_helper.h" |
| #include "chrome/browser/guest_view/web_view/web_view_permission_types.h" |
| #include "chrome/common/extensions/api/webview.h" |
| #include "content/public/browser/javascript_dialog_manager.h" |
| @@ -202,24 +203,13 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| bool allowed_by_default, |
| const base::Callback<void(bool)>& callback); |
| - enum PermissionResponseAction { |
| - DENY, |
| - ALLOW, |
| - DEFAULT |
| - }; |
| - |
| - enum SetPermissionResult { |
| - SET_PERMISSION_INVALID, |
| - SET_PERMISSION_ALLOWED, |
| - SET_PERMISSION_DENIED |
| - }; |
| - |
| // Responds to the permission request |request_id| with |action| and |
| // |user_input|. Returns whether there was a pending request for the provided |
| // |request_id|. |
| - SetPermissionResult SetPermission(int request_id, |
| - PermissionResponseAction action, |
| - const std::string& user_input); |
| + WebViewPermissionHelper::SetPermissionResult SetPermission( |
| + int request_id, |
| + WebViewPermissionHelper::PermissionResponseAction action, |
| + const std::string& user_input); |
| // Overrides the user agent for this guest. |
| // This affects subsequent guest navigations. |
| @@ -279,69 +269,14 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| private: |
| virtual ~WebViewGuest(); |
| - // A map to store the callback for a request keyed by the request's id. |
| - struct PermissionResponseInfo { |
| - PermissionResponseCallback callback; |
| - WebViewPermissionType permission_type; |
| - bool allowed_by_default; |
| - PermissionResponseInfo(); |
| - PermissionResponseInfo(const PermissionResponseCallback& callback, |
| - WebViewPermissionType permission_type, |
| - bool allowed_by_default); |
| - ~PermissionResponseInfo(); |
| - }; |
| - |
| - static void RecordUserInitiatedUMA(const PermissionResponseInfo& info, |
| - bool allow); |
| - |
| // Returns the top level items (ignoring submenus) as Value. |
| static scoped_ptr<base::ListValue> MenuModelToValue( |
| const ui::SimpleMenuModel& menu_model); |
| - void OnWebViewGeolocationPermissionResponse( |
| - int bridge_id, |
| - bool user_gesture, |
| - const base::Callback<void(bool)>& callback, |
| - bool allow, |
| - const std::string& user_input); |
| - |
| - void OnWebViewFileSystemPermissionResponse( |
| - const base::Callback<void(bool)>& callback, |
| - bool allow, |
| - const std::string& user_input); |
| - |
| - void OnWebViewMediaPermissionResponse( |
| - const content::MediaStreamRequest& request, |
| - const content::MediaResponseCallback& callback, |
| - bool allow, |
| - const std::string& user_input); |
| - |
| - void OnWebViewDownloadPermissionResponse( |
| - const base::Callback<void(bool)>& callback, |
| - bool allow, |
| - const std::string& user_input); |
| - |
| - void OnWebViewPointerLockPermissionResponse( |
| - const base::Callback<void(bool)>& callback, |
| - bool allow, |
| - const std::string& user_input); |
| - |
| void OnWebViewNewWindowResponse(int new_window_instance_id, |
| bool allow, |
| const std::string& user_input); |
| - static void FileSystemAccessedAsyncResponse(int render_process_id, |
| - int render_frame_id, |
| - int request_id, |
| - const GURL& url, |
| - bool allowed); |
| - |
| - static void FileSystemAccessedSyncResponse(int render_process_id, |
| - int render_frame_id, |
| - const GURL& url, |
| - IPC::Message* reply_msg, |
| - bool allowed); |
| - |
| // WebContentsObserver implementation. |
| virtual void DidCommitProvisionalLoadForFrame( |
| int64 frame_id, |
| @@ -399,11 +334,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| void InjectChromeVoxIfNeeded(content::RenderViewHost* render_view_host); |
| - // Bridge IDs correspond to a geolocation request. This method will remove |
| - // the bookkeeping for a particular geolocation request associated with the |
| - // provided |bridge_id|. It returns the request ID of the geolocation request. |
| - int RemoveBridgeID(int bridge_id); |
| - |
| void LoadURLWithParams(const GURL& url, |
| const content::Referrer& referrer, |
| content::PageTransition transition_type, |
| @@ -445,13 +375,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| // We only need the ids to be unique for a given WebViewGuest. |
| int pending_context_menu_request_id_; |
| - // 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_; |
| - |
| - typedef std::map<int, PermissionResponseInfo> RequestMap; |
| - RequestMap pending_permission_requests_; |
| - |
| // True if the user agent is overridden. |
| bool is_overriding_user_agent_; |
| @@ -477,6 +400,9 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| // Handles the JavaScript dialog requests. |
| JavaScriptDialogHelper javascript_dialog_helper_; |
| + // Handels permission requests. |
| + WebViewPermissionHelper* web_view_permission_helper_; |
|
Fady Samuel
2014/06/20 22:54:33
Don't make this a pointer. Make it a value.
WebVi
|
| + |
| friend void WebviewFindHelper::DispatchFindUpdateEvent(bool canceled, |
| bool final_update); |
| @@ -490,8 +416,6 @@ class WebViewGuest : public GuestView<WebViewGuest>, |
| accessibility_subscription_; |
| #endif |
| - std::map<int, int> bridge_id_to_request_id_map_; |
| - |
| // Tracks the name, and target URL of the new window. Once the first |
| // navigation commits, we no longer track this information. |
| struct NewWindowInfo { |