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

Unified Diff: chrome/browser/android/chrome_web_contents_delegate_android.cc

Issue 11112022: Add DownloadControllerAndroid public interface for android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding OWNERS file Created 8 years, 2 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/android/chrome_web_contents_delegate_android.cc
diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.cc b/chrome/browser/android/chrome_web_contents_delegate_android.cc
index a7de6d71995e9979c9647a7ff38f45febca37e0f..a063d6d65125300471fec3f4891f3726459163aa 100644
--- a/chrome/browser/android/chrome_web_contents_delegate_android.cc
+++ b/chrome/browser/android/chrome_web_contents_delegate_android.cc
@@ -11,12 +11,14 @@
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
#include "chrome/common/chrome_notification_types.h"
+#include "content/public/browser/android/download_controller_android.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/file_chooser_params.h"
#include "jni/ChromeWebContentsDelegateAndroid_jni.h"
+#include "net/http/http_request_headers.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/rect_f.h"
@@ -234,5 +236,24 @@ ChromeWebContentsDelegateAndroid::GetJavaScriptDialogCreator() {
return GetJavaScriptDialogCreatorInstance();
}
+bool ChromeWebContentsDelegateAndroid::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;
+ }
+ return true;
+}
+
+void ChromeWebContentsDelegateAndroid::OnStartDownload(
+ WebContents* source,
+ content::DownloadItem* download) {
+ content::DownloadControllerAndroid::Get()->OnPostDownloadStarted(
+ source, download);
+}
+
} // namespace android
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698