| 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/browser/aw_content_browser_client.h" | 5 #include "android_webview/browser/aw_content_browser_client.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| 11 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 11 #include "android_webview/browser/aw_contents_client_bridge.h" |
| 12 #include "android_webview/browser/aw_contents_io_thread_client.h" | 12 #include "android_webview/browser/aw_contents_io_thread_client.h" |
| 13 #include "android_webview/browser/aw_cookie_access_policy.h" | 13 #include "android_webview/browser/aw_cookie_access_policy.h" |
| 14 #include "android_webview/browser/aw_devtools_manager_delegate.h" | 14 #include "android_webview/browser/aw_devtools_manager_delegate.h" |
| 15 #include "android_webview/browser/aw_locale_manager.h" | 15 #include "android_webview/browser/aw_locale_manager.h" |
| 16 #include "android_webview/browser/aw_printing_message_filter.h" | 16 #include "android_webview/browser/aw_printing_message_filter.h" |
| 17 #include "android_webview/browser/aw_quota_permission_context.h" | 17 #include "android_webview/browser/aw_quota_permission_context.h" |
| 18 #include "android_webview/browser/aw_web_preferences_populater.h" | 18 #include "android_webview/browser/aw_web_preferences_populater.h" |
| 19 #include "android_webview/browser/jni_dependency_factory.h" | 19 #include "android_webview/browser/jni_dependency_factory.h" |
| 20 #include "android_webview/browser/net/aw_url_request_context_getter.h" | 20 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
| 21 #include "android_webview/browser/net_disk_cache_remover.h" | 21 #include "android_webview/browser/net_disk_cache_remover.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 void AwContentsMessageFilter::OnShouldOverrideUrlLoading( | 139 void AwContentsMessageFilter::OnShouldOverrideUrlLoading( |
| 140 int render_frame_id, | 140 int render_frame_id, |
| 141 const base::string16& url, | 141 const base::string16& url, |
| 142 bool has_user_gesture, | 142 bool has_user_gesture, |
| 143 bool is_redirect, | 143 bool is_redirect, |
| 144 bool is_main_frame, | 144 bool is_main_frame, |
| 145 bool* ignore_navigation) { | 145 bool* ignore_navigation) { |
| 146 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 146 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 147 *ignore_navigation = false; | 147 *ignore_navigation = false; |
| 148 AwContentsClientBridgeBase* client = | 148 AwContentsClientBridge* client = |
| 149 AwContentsClientBridgeBase::FromID(process_id_, render_frame_id); | 149 AwContentsClientBridge::FromID(process_id_, render_frame_id); |
| 150 if (client) { | 150 if (client) { |
| 151 *ignore_navigation = client->ShouldOverrideUrlLoading( | 151 *ignore_navigation = client->ShouldOverrideUrlLoading( |
| 152 url, has_user_gesture, is_redirect, is_main_frame); | 152 url, has_user_gesture, is_redirect, is_main_frame); |
| 153 // If the shouldOverrideUrlLoading call caused a java exception we should | 153 // If the shouldOverrideUrlLoading call caused a java exception we should |
| 154 // always return immediately here! | 154 // always return immediately here! |
| 155 } else { | 155 } else { |
| 156 LOG(WARNING) << "Failed to find the associated render view host for url: " | 156 LOG(WARNING) << "Failed to find the associated render view host for url: " |
| 157 << url; | 157 << url; |
| 158 } | 158 } |
| 159 } | 159 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 content::WebContents* web_contents, | 378 content::WebContents* web_contents, |
| 379 int cert_error, | 379 int cert_error, |
| 380 const net::SSLInfo& ssl_info, | 380 const net::SSLInfo& ssl_info, |
| 381 const GURL& request_url, | 381 const GURL& request_url, |
| 382 ResourceType resource_type, | 382 ResourceType resource_type, |
| 383 bool overridable, | 383 bool overridable, |
| 384 bool strict_enforcement, | 384 bool strict_enforcement, |
| 385 bool expired_previous_decision, | 385 bool expired_previous_decision, |
| 386 const base::Callback<void(content::CertificateRequestResultType)>& | 386 const base::Callback<void(content::CertificateRequestResultType)>& |
| 387 callback) { | 387 callback) { |
| 388 AwContentsClientBridgeBase* client = | 388 AwContentsClientBridge* client = |
| 389 AwContentsClientBridgeBase::FromWebContents(web_contents); | 389 AwContentsClientBridge::FromWebContents(web_contents); |
| 390 bool cancel_request = true; | 390 bool cancel_request = true; |
| 391 if (client) | 391 if (client) |
| 392 client->AllowCertificateError(cert_error, | 392 client->AllowCertificateError(cert_error, |
| 393 ssl_info.cert.get(), | 393 ssl_info.cert.get(), |
| 394 request_url, | 394 request_url, |
| 395 callback, | 395 callback, |
| 396 &cancel_request); | 396 &cancel_request); |
| 397 if (cancel_request) | 397 if (cancel_request) |
| 398 callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY); | 398 callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void AwContentBrowserClient::SelectClientCertificate( | 401 void AwContentBrowserClient::SelectClientCertificate( |
| 402 content::WebContents* web_contents, | 402 content::WebContents* web_contents, |
| 403 net::SSLCertRequestInfo* cert_request_info, | 403 net::SSLCertRequestInfo* cert_request_info, |
| 404 net::CertificateList client_certs, | 404 net::CertificateList client_certs, |
| 405 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 405 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
| 406 AwContentsClientBridgeBase* client = | 406 AwContentsClientBridge* client = |
| 407 AwContentsClientBridgeBase::FromWebContents(web_contents); | 407 AwContentsClientBridge::FromWebContents(web_contents); |
| 408 if (client) | 408 if (client) |
| 409 client->SelectClientCertificate(cert_request_info, std::move(delegate)); | 409 client->SelectClientCertificate(cert_request_info, std::move(delegate)); |
| 410 } | 410 } |
| 411 | 411 |
| 412 bool AwContentBrowserClient::CanCreateWindow( | 412 bool AwContentBrowserClient::CanCreateWindow( |
| 413 content::RenderFrameHost* opener, | 413 content::RenderFrameHost* opener, |
| 414 const GURL& opener_url, | 414 const GURL& opener_url, |
| 415 const GURL& opener_top_level_frame_url, | 415 const GURL& opener_top_level_frame_url, |
| 416 const GURL& source_origin, | 416 const GURL& source_origin, |
| 417 content::mojom::WindowContainerType container_type, | 417 content::mojom::WindowContainerType container_type, |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 render_frame_host)); | 565 render_frame_host)); |
| 566 | 566 |
| 567 // Although WebView does not support password manager feature, renderer code | 567 // Although WebView does not support password manager feature, renderer code |
| 568 // could still request this interface, so we register a dummy binder which | 568 // could still request this interface, so we register a dummy binder which |
| 569 // just drops the incoming request, to avoid the 'Failed to locate a binder | 569 // just drops the incoming request, to avoid the 'Failed to locate a binder |
| 570 // for interface' error log.. | 570 // for interface' error log.. |
| 571 registry->AddInterface(base::Bind(&DummyBindPasswordManagerDriver)); | 571 registry->AddInterface(base::Bind(&DummyBindPasswordManagerDriver)); |
| 572 } | 572 } |
| 573 | 573 |
| 574 } // namespace android_webview | 574 } // namespace android_webview |
| OLD | NEW |