Return false in AwWebContentsDelegate::CanDownload

Android webview intercepts download in its resource dispatcher host delegate

BUG=


Review URL: https://chromiumcodereview.appspot.com/11821011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175708 0039d316-1c4b-4281-b951-d872f2087c98
parent a692b63a
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
#include "content/public/browser/download_manager_delegate.h" #include "content/public/browser/download_manager_delegate.h"
namespace content {
class DownloadItem;
} // namespace content
namespace android_webview { namespace android_webview {
// Android WebView does not use Chromium downloads, so implement methods here to // Android WebView does not use Chromium downloads, so implement methods here to
...@@ -31,6 +27,6 @@ class AwDownloadManagerDelegate : public content::DownloadManagerDelegate { ...@@ -31,6 +27,6 @@ class AwDownloadManagerDelegate : public content::DownloadManagerDelegate {
const content::DownloadOpenDelayedCallback& callback) OVERRIDE; const content::DownloadOpenDelayedCallback& callback) OVERRIDE;
}; };
} // anemspace android_webview } // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_AW_DOWNLOAD_MANAGER_DELEGATE_H_ #endif // ANDROID_WEBVIEW_BROWSER_AW_DOWNLOAD_MANAGER_DELEGATE_H_
...@@ -10,10 +10,8 @@ ...@@ -10,10 +10,8 @@
#include "base/android/scoped_java_ref.h" #include "base/android/scoped_java_ref.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "content/public/browser/android/download_controller_android.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "jni/AwWebContentsDelegate_jni.h" #include "jni/AwWebContentsDelegate_jni.h"
#include "net/http/http_request_headers.h"
using base::android::AttachCurrentThread; using base::android::AttachCurrentThread;
using base::android::ScopedJavaLocalRef; using base::android::ScopedJavaLocalRef;
...@@ -57,16 +55,15 @@ void AwWebContentsDelegate::FindReply(WebContents* web_contents, ...@@ -57,16 +55,15 @@ void AwWebContentsDelegate::FindReply(WebContents* web_contents,
bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source, bool AwWebContentsDelegate::CanDownload(content::RenderViewHost* source,
int request_id, int request_id,
const std::string& request_method) { const std::string& request_method) {
if (request_method == net::HttpRequestHeaders::kGetMethod) { // Android webview intercepts download in its resource dispatcher host
content::DownloadControllerAndroid::Get()->CreateGETDownload( // delegate, so should not reach here.
source, request_id); NOTREACHED();
}
return false; return false;
} }
void AwWebContentsDelegate::OnStartDownload(WebContents* source, void AwWebContentsDelegate::OnStartDownload(WebContents* source,
content::DownloadItem* download) { content::DownloadItem* download) {
NOTREACHED(); // We always return false in CanDownload. NOTREACHED(); // Downloads are cancelled in ResourceDispatcherHostDelegate.
} }
void AwWebContentsDelegate::AddNewContents(content::WebContents* source, void AwWebContentsDelegate::AddNewContents(content::WebContents* source,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment