diff options
author | nileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-15 21:22:57 +0000 |
---|---|---|
committer | nileshagrawal@chromium.org <nileshagrawal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-15 21:22:57 +0000 |
commit | 7f8619f5efb65439516b2dc0764f4ad1e631789d (patch) | |
tree | 73c29e064bd7ca81b1e7395bd254e87dd513dd60 /android_webview | |
parent | 5752e6b1de5287e558d9074f58fefdba0579bf82 (diff) | |
download | chromium_src-7f8619f5efb65439516b2dc0764f4ad1e631789d.zip chromium_src-7f8619f5efb65439516b2dc0764f4ad1e631789d.tar.gz chromium_src-7f8619f5efb65439516b2dc0764f4ad1e631789d.tar.bz2 |
Add DownloadControllerAndroid public interface for android.
BUG=
Review URL: https://chromiumcodereview.appspot.com/11112022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161964 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r-- | android_webview/native/aw_web_contents_delegate.cc | 17 | ||||
-rw-r--r-- | android_webview/native/aw_web_contents_delegate.h | 5 |
2 files changed, 22 insertions, 0 deletions
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc index 2a04d2d..33e8edd 100644 --- a/android_webview/native/aw_web_contents_delegate.cc +++ b/android_webview/native/aw_web_contents_delegate.cc @@ -8,7 +8,9 @@ #include "android_webview/browser/find_helper.h" #include "android_webview/native/aw_contents.h" #include "android_webview/native/aw_javascript_dialog_creator.h" +#include "content/public/browser/android/download_controller_android.h" #include "content/public/browser/web_contents.h" +#include "net/http/http_request_headers.h" using content::WebContents; @@ -47,4 +49,19 @@ void AwWebContentsDelegate::FindReply(WebContents* web_contents, final_update); } +bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, + int request_id, + const std::string& request_method) { + if (request_method == net::HttpRequestHeaders::kGetMethod) { + content::DownloadControllerAndroid::Get()->CreateGETDownload( + source, request_id); + } + return false; +} + +void AwWebContentsDelegate::OnStartDownload(WebContents* source, + content::DownloadItem* download) { + NOTREACHED(); // We always return false in CanDownload. +} + } // namespace android_webview diff --git a/android_webview/native/aw_web_contents_delegate.h b/android_webview/native/aw_web_contents_delegate.h index 1ce3f31..81ba38a 100644 --- a/android_webview/native/aw_web_contents_delegate.h +++ b/android_webview/native/aw_web_contents_delegate.h @@ -27,6 +27,11 @@ class AwWebContentsDelegate const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) OVERRIDE; + virtual bool CanDownload(content::RenderViewHost* source, + int request_id, + const std::string& request_method) OVERRIDE; + virtual void OnStartDownload(content::WebContents* source, + content::DownloadItem* download) OVERRIDE; }; } // namespace android_webview |