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

Unified Diff: android_webview/native/aw_web_contents_delegate.cc

Issue 11112022: Add DownloadControllerAndroid public interface for android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra include 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: android_webview/native/aw_web_contents_delegate.cc
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc
index 2a04d2dd7f29f0a6521218eb4dc9085e7658e012..8bc45813d789856dc845e7a528e75bde8c3d56e1 100644
--- a/android_webview/native/aw_web_contents_delegate.cc
+++ b/android_webview/native/aw_web_contents_delegate.cc
@@ -8,7 +8,10 @@
#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/download_item.h"
joth 2012/10/12 20:50:03 nit: forward declare DownloadItem rather than #inc
nilesh 2012/10/12 21:07:45 Done.
#include "content/public/browser/web_contents.h"
+#include "net/http/http_request_headers.h"
using content::WebContents;
@@ -47,4 +50,21 @@ 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;
+ }
+ return true;
joth 2012/10/12 20:50:03 always return false here, as we (currently) never
nilesh 2012/10/12 21:07:45 Done.
nilesh 2012/10/12 21:31:19 I think you meant return false always, but still h
+}
+
+void AwWebContentsDelegate::OnStartDownload(WebContents* source,
+ content::DownloadItem* download) {
+ content::DownloadControllerAndroid::Get()->OnPostDownloadStarted(
+ source, download);
joth 2012/10/12 20:50:03 replace this with NOTREACHED(); // We always retu
nilesh 2012/10/12 21:07:45 Done.
+}
+
} // namespace android_webview
« no previous file with comments | « android_webview/native/aw_web_contents_delegate.h ('k') | chrome/browser/android/chrome_web_contents_delegate_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698