OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" | 5 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "chrome/browser/file_select_helper.h" | 8 #include "chrome/browser/file_select_helper.h" |
9 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" | 9 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_creator.h" |
10 #include "chrome/browser/ui/find_bar/find_match_rects_details.h" | 10 #include "chrome/browser/ui/find_bar/find_match_rects_details.h" |
11 #include "chrome/browser/ui/find_bar/find_notification_details.h" | 11 #include "chrome/browser/ui/find_bar/find_notification_details.h" |
12 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 12 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
| 14 #include "content/public/browser/android/download_controller_android.h" |
14 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/common/file_chooser_params.h" | 19 #include "content/public/common/file_chooser_params.h" |
19 #include "jni/ChromeWebContentsDelegateAndroid_jni.h" | 20 #include "jni/ChromeWebContentsDelegateAndroid_jni.h" |
| 21 #include "net/http/http_request_headers.h" |
20 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
21 #include "ui/gfx/rect_f.h" | 23 #include "ui/gfx/rect_f.h" |
22 | 24 |
23 using base::android::AttachCurrentThread; | 25 using base::android::AttachCurrentThread; |
24 using base::android::GetClass; | 26 using base::android::GetClass; |
25 using base::android::ScopedJavaLocalRef; | 27 using base::android::ScopedJavaLocalRef; |
26 using content::FileChooserParams; | 28 using content::FileChooserParams; |
27 using content::WebContents; | 29 using content::WebContents; |
28 | 30 |
29 namespace { | 31 namespace { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 env, | 229 env, |
228 obj.obj(), | 230 obj.obj(), |
229 details_object.obj()); | 231 details_object.obj()); |
230 } | 232 } |
231 | 233 |
232 content::JavaScriptDialogCreator* | 234 content::JavaScriptDialogCreator* |
233 ChromeWebContentsDelegateAndroid::GetJavaScriptDialogCreator() { | 235 ChromeWebContentsDelegateAndroid::GetJavaScriptDialogCreator() { |
234 return GetJavaScriptDialogCreatorInstance(); | 236 return GetJavaScriptDialogCreatorInstance(); |
235 } | 237 } |
236 | 238 |
| 239 bool ChromeWebContentsDelegateAndroid::CanDownload( |
| 240 content::RenderViewHost* source, |
| 241 int request_id, |
| 242 const std::string& request_method) { |
| 243 if (request_method == net::HttpRequestHeaders::kGetMethod) { |
| 244 content::DownloadControllerAndroid::Get()->CreateGETDownload( |
| 245 source, request_id); |
| 246 return false; |
| 247 } |
| 248 return true; |
| 249 } |
| 250 |
| 251 void ChromeWebContentsDelegateAndroid::OnStartDownload( |
| 252 WebContents* source, |
| 253 content::DownloadItem* download) { |
| 254 content::DownloadControllerAndroid::Get()->OnPostDownloadStarted( |
| 255 source, download); |
| 256 } |
| 257 |
237 } // namespace android | 258 } // namespace android |
238 } // namespace chrome | 259 } // namespace chrome |
OLD | NEW |