diff options
author | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 09:01:54 +0000 |
---|---|---|
committer | lazyboy@chromium.org <lazyboy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-03 09:01:54 +0000 |
commit | f85f5037bcba6e52fedae883add00b39f824edc3 (patch) | |
tree | 60a6c3fd2830a90d7c18fc6700f1d144bba04ef3 /content/browser/browser_plugin/browser_plugin_guest.h | |
parent | 090374df3d55fbe4e173d78e43684aa93675063d (diff) | |
download | chromium_src-f85f5037bcba6e52fedae883add00b39f824edc3.zip chromium_src-f85f5037bcba6e52fedae883add00b39f824edc3.tar.gz chromium_src-f85f5037bcba6e52fedae883add00b39f824edc3.tar.bz2 |
permissionrequest API for guest Download.
Exposed event:
event.type = 'download'
event.requestMethod = 'GET'/'POST'...
event.url = url
BUG=141204
TEST=Pending: osx + win (b/c there is a *ViewGuest change).
Added browser_tests:WebViewTest.Download, ran unit_tests:DownloadRequestLimiterTest*
Review URL: https://chromiumcodereview.appspot.com/13037003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192029 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_plugin/browser_plugin_guest.h')
-rw-r--r-- | content/browser/browser_plugin/browser_plugin_guest.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/content/browser/browser_plugin/browser_plugin_guest.h b/content/browser/browser_plugin/browser_plugin_guest.h index aaa2cc9..605cafc 100644 --- a/content/browser/browser_plugin/browser_plugin_guest.h +++ b/content/browser/browser_plugin/browser_plugin_guest.h @@ -172,9 +172,10 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) OVERRIDE; - virtual bool CanDownload(RenderViewHost* render_view_host, + virtual void CanDownload(RenderViewHost* render_view_host, int request_id, - const std::string& request_method) OVERRIDE; + const std::string& request_method, + const base::Callback<void(bool)>& callback) OVERRIDE; virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; virtual void WebContentsCreated(WebContents* source_contents, int64 source_frame_id, @@ -219,7 +220,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, void Attach(WebContentsImpl* embedder_web_contents, BrowserPluginHostMsg_CreateGuest_Params params); - // Requests geolocation permission through embedder js api. + // Requests geolocation permission through Embedder JavaScript API. void AskEmbedderForGeolocationPermission(int bridge_id, const GURL& requesting_frame, const GeolocationCallback& callback); @@ -228,6 +229,7 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, // Embedder sets permission to allow or deny geolocation request. void SetGeolocationPermission(int request_id, bool allowed); + // Allow the embedder to call this for unhandled messages when // BrowserPluginGuest is already destroyed. static void AcknowledgeBufferPresent(int route_id, @@ -388,10 +390,17 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); // Helpers for |OnRespondPermission|. + void OnRespondPermissionDownload(int request_id, bool should_allow); void OnRespondPermissionGeolocation(int request_id, bool should_allow); void OnRespondPermissionMedia(int request_id, bool should_allow); void OnRespondPermissionNewWindow(int request_id, bool should_allow); + // Requests download permission through embedder JavaScript API after + // retrieving url information from IO thread. + void DidRetrieveDownloadURLFromRequestId(const std::string& request_method, + int permission_request_id, + const std::string& url); + // Weak pointer used to ask GeolocationPermissionContext about geolocation // permission. base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; @@ -441,6 +450,9 @@ class CONTENT_EXPORT BrowserPluginGuest : public NotificationObserver, typedef std::map<int, int> NewWindowRequestMap; NewWindowRequestMap new_window_request_map_; + typedef std::map<int, base::Callback<void(bool)> > DownloadRequestMap; + DownloadRequestMap download_request_callback_map_; + DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); }; |