| 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 "android_webview/native/aw_contents_io_thread_client_impl.h" | 5 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 bool AwContentsIoThreadClientImpl::ShouldBlockNetworkLoads() const { | 395 bool AwContentsIoThreadClientImpl::ShouldBlockNetworkLoads() const { |
| 396 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 396 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 397 if (java_object_.is_null()) | 397 if (java_object_.is_null()) |
| 398 return false; | 398 return false; |
| 399 | 399 |
| 400 JNIEnv* env = AttachCurrentThread(); | 400 JNIEnv* env = AttachCurrentThread(); |
| 401 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(env, | 401 return Java_AwContentsIoThreadClient_shouldBlockNetworkLoads(env, |
| 402 java_object_); | 402 java_object_); |
| 403 } | 403 } |
| 404 | 404 |
| 405 void AwContentsIoThreadClientImpl::NewDownload( | |
| 406 const GURL& url, | |
| 407 const string& user_agent, | |
| 408 const string& content_disposition, | |
| 409 const string& mime_type, | |
| 410 int64_t content_length) { | |
| 411 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
| 412 if (java_object_.is_null()) | |
| 413 return; | |
| 414 | |
| 415 JNIEnv* env = AttachCurrentThread(); | |
| 416 ScopedJavaLocalRef<jstring> jstring_url = | |
| 417 ConvertUTF8ToJavaString(env, url.spec()); | |
| 418 ScopedJavaLocalRef<jstring> jstring_user_agent = | |
| 419 ConvertUTF8ToJavaString(env, user_agent); | |
| 420 ScopedJavaLocalRef<jstring> jstring_content_disposition = | |
| 421 ConvertUTF8ToJavaString(env, content_disposition); | |
| 422 ScopedJavaLocalRef<jstring> jstring_mime_type = | |
| 423 ConvertUTF8ToJavaString(env, mime_type); | |
| 424 | |
| 425 Java_AwContentsIoThreadClient_onDownloadStart( | |
| 426 env, java_object_, jstring_url, jstring_user_agent, | |
| 427 jstring_content_disposition, jstring_mime_type, content_length); | |
| 428 } | |
| 429 | |
| 430 void AwContentsIoThreadClientImpl::NewLoginRequest(const string& realm, | 405 void AwContentsIoThreadClientImpl::NewLoginRequest(const string& realm, |
| 431 const string& account, | 406 const string& account, |
| 432 const string& args) { | 407 const string& args) { |
| 433 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 408 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 434 if (java_object_.is_null()) | 409 if (java_object_.is_null()) |
| 435 return; | 410 return; |
| 436 | 411 |
| 437 JNIEnv* env = AttachCurrentThread(); | 412 JNIEnv* env = AttachCurrentThread(); |
| 438 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); | 413 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); |
| 439 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args); | 414 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 Java_AwContentsIoThreadClient_onReceivedHttpError( | 480 Java_AwContentsIoThreadClient_onReceivedHttpError( |
| 506 env, java_object_, web_request.jstring_url, web_request.is_main_frame, | 481 env, java_object_, web_request.jstring_url, web_request.is_main_frame, |
| 507 web_request.has_user_gesture, web_request.jstring_method, | 482 web_request.has_user_gesture, web_request.jstring_method, |
| 508 web_request.jstringArray_header_names, | 483 web_request.jstringArray_header_names, |
| 509 web_request.jstringArray_header_values, jstring_mime_type, | 484 web_request.jstringArray_header_values, jstring_mime_type, |
| 510 jstring_encoding, status_code, jstring_reason, | 485 jstring_encoding, status_code, jstring_reason, |
| 511 jstringArray_response_header_names, jstringArray_response_header_values); | 486 jstringArray_response_header_names, jstringArray_response_header_values); |
| 512 } | 487 } |
| 513 | 488 |
| 514 } // namespace android_webview | 489 } // namespace android_webview |
| OLD | NEW |