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::NewLoginRequest(const string& realm, | |
406 const string& account, | |
407 const string& args) { | |
408 DCHECK_CURRENTLY_ON(BrowserThread::IO); | |
409 if (java_object_.is_null()) | |
410 return; | |
411 | |
412 JNIEnv* env = AttachCurrentThread(); | |
413 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); | |
414 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args); | |
415 | |
416 ScopedJavaLocalRef<jstring> jaccount; | |
417 if (!account.empty()) | |
418 jaccount = ConvertUTF8ToJavaString(env, account); | |
419 | |
420 Java_AwContentsIoThreadClient_newLoginRequest(env, java_object_, jrealm, | |
421 jaccount, jargs); | |
422 } | |
423 | |
424 void AwContentsIoThreadClientImpl::OnReceivedError( | 405 void AwContentsIoThreadClientImpl::OnReceivedError( |
425 const net::URLRequest* request) { | 406 const net::URLRequest* request) { |
426 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 407 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
427 if (java_object_.is_null()) | 408 if (java_object_.is_null()) |
428 return; | 409 return; |
429 | 410 |
430 JNIEnv* env = AttachCurrentThread(); | 411 JNIEnv* env = AttachCurrentThread(); |
431 WebResourceRequest web_request(env, request); | 412 WebResourceRequest web_request(env, request); |
432 | 413 |
433 int error_code = request->status().error(); | 414 int error_code = request->status().error(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 Java_AwContentsIoThreadClient_onReceivedHttpError( | 461 Java_AwContentsIoThreadClient_onReceivedHttpError( |
481 env, java_object_, web_request.jstring_url, web_request.is_main_frame, | 462 env, java_object_, web_request.jstring_url, web_request.is_main_frame, |
482 web_request.has_user_gesture, web_request.jstring_method, | 463 web_request.has_user_gesture, web_request.jstring_method, |
483 web_request.jstringArray_header_names, | 464 web_request.jstringArray_header_names, |
484 web_request.jstringArray_header_values, jstring_mime_type, | 465 web_request.jstringArray_header_values, jstring_mime_type, |
485 jstring_encoding, status_code, jstring_reason, | 466 jstring_encoding, status_code, jstring_reason, |
486 jstringArray_response_header_names, jstringArray_response_header_values); | 467 jstringArray_response_header_names, jstringArray_response_header_values); |
487 } | 468 } |
488 | 469 |
489 } // namespace android_webview | 470 } // namespace android_webview |
OLD | NEW |