| 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 "content/browser/android/download_controller_android_impl.h" | 5 #include "content/browser/android/download_controller_android_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/browser/android/content_view_core_impl.h" | 12 #include "content/browser/android/content_view_core_impl.h" |
| 13 #include "content/browser/download/download_item_impl.h" | 13 #include "content/browser/download/download_item_impl.h" |
| 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 14 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_process_host_impl.h" | 15 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 16 #include "content/browser/renderer_host/render_view_host_delegate.h" | 16 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 17 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 18 #include "content/browser/web_contents/web_contents_impl.h" | 18 #include "content/browser/web_contents/web_contents_impl.h" |
| 19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/global_request_id.h" | 20 #include "content/public/browser/global_request_id.h" |
| 21 #include "content/public/browser/web_contents_view.h" |
| 21 #include "jni/DownloadController_jni.h" | 22 #include "jni/DownloadController_jni.h" |
| 22 #include "net/cookies/cookie_options.h" | 23 #include "net/cookies/cookie_options.h" |
| 23 #include "net/cookies/cookie_store.h" | 24 #include "net/cookies/cookie_store.h" |
| 24 #include "net/http/http_request_headers.h" | 25 #include "net/http/http_request_headers.h" |
| 25 #include "net/http/http_response_headers.h" | 26 #include "net/http/http_response_headers.h" |
| 26 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
| 27 #include "net/url_request/url_request_context.h" | 28 #include "net/url_request/url_request_context.h" |
| 28 | 29 |
| 29 using base::android::AttachCurrentThread; | 30 using base::android::AttachCurrentThread; |
| 30 using base::android::CheckException; | 31 using base::android::CheckException; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 305 |
| 305 return GetContentViewCoreFromWebContents(web_contents); | 306 return GetContentViewCoreFromWebContents(web_contents); |
| 306 } | 307 } |
| 307 | 308 |
| 308 ScopedJavaLocalRef<jobject> | 309 ScopedJavaLocalRef<jobject> |
| 309 DownloadControllerAndroidImpl::GetContentViewCoreFromWebContents( | 310 DownloadControllerAndroidImpl::GetContentViewCoreFromWebContents( |
| 310 WebContents* web_contents) { | 311 WebContents* web_contents) { |
| 311 if (!web_contents) | 312 if (!web_contents) |
| 312 return ScopedJavaLocalRef<jobject>(); | 313 return ScopedJavaLocalRef<jobject>(); |
| 313 | 314 |
| 314 ContentViewCore* view_core = web_contents->GetContentNativeView(); | 315 ContentViewCore* view_core = web_contents->GetView()->GetContentNativeView(); |
| 315 return view_core ? view_core->GetJavaObject() : | 316 return view_core ? view_core->GetJavaObject() : |
| 316 ScopedJavaLocalRef<jobject>(); | 317 ScopedJavaLocalRef<jobject>(); |
| 317 } | 318 } |
| 318 | 319 |
| 319 DownloadControllerAndroidImpl::JavaObject* | 320 DownloadControllerAndroidImpl::JavaObject* |
| 320 DownloadControllerAndroidImpl::GetJavaObject() { | 321 DownloadControllerAndroidImpl::GetJavaObject() { |
| 321 if (!java_object_) { | 322 if (!java_object_) { |
| 322 // Initialize Java DownloadController by calling | 323 // Initialize Java DownloadController by calling |
| 323 // DownloadController.getInstance(), which will call Init() | 324 // DownloadController.getInstance(), which will call Init() |
| 324 // if Java DownloadController is not instantiated already. | 325 // if Java DownloadController is not instantiated already. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 351 referer = referer_url.spec(); | 352 referer = referer_url.spec(); |
| 352 if (!request->url_chain().empty()) { | 353 if (!request->url_chain().empty()) { |
| 353 original_url = request->url_chain().front(); | 354 original_url = request->url_chain().front(); |
| 354 url = request->url_chain().back(); | 355 url = request->url_chain().back(); |
| 355 } | 356 } |
| 356 } | 357 } |
| 357 | 358 |
| 358 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} | 359 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} |
| 359 | 360 |
| 360 } // namespace content | 361 } // namespace content |
| OLD | NEW |