Chromium Code Reviews| 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 |