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

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: 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..2aa6e4ab09a317d43c9baa5d895544332da06def 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"
@@ -26,6 +28,10 @@ using base::android::ScopedJavaLocalRef;
using content::FileChooserParams;
using content::WebContents;
+namespace content {
+class DownloadItem;
+}
jam 2012/10/15 06:45:04 nit: unnecessary
nilesh 2012/10/15 17:13:51 Removed
+
namespace {
// Convenience method to create Android rects.
@@ -234,5 +240,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