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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698