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> |
| 8 |
7 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
9 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 11 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
10 #include "android_webview/browser/aw_contents_io_thread_client.h" | 12 #include "android_webview/browser/aw_contents_io_thread_client.h" |
11 #include "android_webview/browser/aw_cookie_access_policy.h" | 13 #include "android_webview/browser/aw_cookie_access_policy.h" |
12 #include "android_webview/browser/aw_locale_manager.h" | 14 #include "android_webview/browser/aw_locale_manager.h" |
13 #include "android_webview/browser/aw_printing_message_filter.h" | 15 #include "android_webview/browser/aw_printing_message_filter.h" |
14 #include "android_webview/browser/aw_quota_permission_context.h" | 16 #include "android_webview/browser/aw_quota_permission_context.h" |
15 #include "android_webview/browser/aw_web_preferences_populater.h" | 17 #include "android_webview/browser/aw_web_preferences_populater.h" |
16 #include "android_webview/browser/jni_dependency_factory.h" | 18 #include "android_webview/browser/jni_dependency_factory.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 host->AddFilter(new AwContentsMessageFilter(host->GetID())); | 187 host->AddFilter(new AwContentsMessageFilter(host->GetID())); |
186 host->AddFilter(new cdm::CdmMessageFilterAndroid()); | 188 host->AddFilter(new cdm::CdmMessageFilterAndroid()); |
187 host->AddFilter(new AwPrintingMessageFilter(host->GetID())); | 189 host->AddFilter(new AwPrintingMessageFilter(host->GetID())); |
188 } | 190 } |
189 | 191 |
190 net::URLRequestContextGetter* AwContentBrowserClient::CreateRequestContext( | 192 net::URLRequestContextGetter* AwContentBrowserClient::CreateRequestContext( |
191 content::BrowserContext* browser_context, | 193 content::BrowserContext* browser_context, |
192 content::ProtocolHandlerMap* protocol_handlers, | 194 content::ProtocolHandlerMap* protocol_handlers, |
193 content::URLRequestInterceptorScopedVector request_interceptors) { | 195 content::URLRequestInterceptorScopedVector request_interceptors) { |
194 DCHECK_EQ(browser_context_.get(), browser_context); | 196 DCHECK_EQ(browser_context_.get(), browser_context); |
195 return browser_context_->CreateRequestContext(protocol_handlers, | 197 return browser_context_->CreateRequestContext( |
196 request_interceptors.Pass()); | 198 protocol_handlers, std::move(request_interceptors)); |
197 } | 199 } |
198 | 200 |
199 net::URLRequestContextGetter* | 201 net::URLRequestContextGetter* |
200 AwContentBrowserClient::CreateRequestContextForStoragePartition( | 202 AwContentBrowserClient::CreateRequestContextForStoragePartition( |
201 content::BrowserContext* browser_context, | 203 content::BrowserContext* browser_context, |
202 const base::FilePath& partition_path, | 204 const base::FilePath& partition_path, |
203 bool in_memory, | 205 bool in_memory, |
204 content::ProtocolHandlerMap* protocol_handlers, | 206 content::ProtocolHandlerMap* protocol_handlers, |
205 content::URLRequestInterceptorScopedVector request_interceptors) { | 207 content::URLRequestInterceptorScopedVector request_interceptors) { |
206 DCHECK_EQ(browser_context_.get(), browser_context); | 208 DCHECK_EQ(browser_context_.get(), browser_context); |
207 // TODO(mkosiba,kinuko): request_interceptors should be hooked up in the | 209 // TODO(mkosiba,kinuko): request_interceptors should be hooked up in the |
208 // downstream. (crbug.com/350286) | 210 // downstream. (crbug.com/350286) |
209 return browser_context_->CreateRequestContextForStoragePartition( | 211 return browser_context_->CreateRequestContextForStoragePartition( |
210 partition_path, in_memory, protocol_handlers, | 212 partition_path, in_memory, protocol_handlers, |
211 request_interceptors.Pass()); | 213 std::move(request_interceptors)); |
212 } | 214 } |
213 | 215 |
214 bool AwContentBrowserClient::IsHandledURL(const GURL& url) { | 216 bool AwContentBrowserClient::IsHandledURL(const GURL& url) { |
215 if (!url.is_valid()) { | 217 if (!url.is_valid()) { |
216 // We handle error cases. | 218 // We handle error cases. |
217 return true; | 219 return true; |
218 } | 220 } |
219 | 221 |
220 const std::string scheme = url.scheme(); | 222 const std::string scheme = url.scheme(); |
221 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); | 223 DCHECK_EQ(scheme, base::ToLowerASCII(scheme)); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; | 381 *result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY; |
380 } | 382 } |
381 | 383 |
382 void AwContentBrowserClient::SelectClientCertificate( | 384 void AwContentBrowserClient::SelectClientCertificate( |
383 content::WebContents* web_contents, | 385 content::WebContents* web_contents, |
384 net::SSLCertRequestInfo* cert_request_info, | 386 net::SSLCertRequestInfo* cert_request_info, |
385 scoped_ptr<content::ClientCertificateDelegate> delegate) { | 387 scoped_ptr<content::ClientCertificateDelegate> delegate) { |
386 AwContentsClientBridgeBase* client = | 388 AwContentsClientBridgeBase* client = |
387 AwContentsClientBridgeBase::FromWebContents(web_contents); | 389 AwContentsClientBridgeBase::FromWebContents(web_contents); |
388 if (client) | 390 if (client) |
389 client->SelectClientCertificate(cert_request_info, delegate.Pass()); | 391 client->SelectClientCertificate(cert_request_info, std::move(delegate)); |
390 } | 392 } |
391 | 393 |
392 bool AwContentBrowserClient::CanCreateWindow( | 394 bool AwContentBrowserClient::CanCreateWindow( |
393 const GURL& opener_url, | 395 const GURL& opener_url, |
394 const GURL& opener_top_level_frame_url, | 396 const GURL& opener_top_level_frame_url, |
395 const GURL& source_origin, | 397 const GURL& source_origin, |
396 WindowContainerType container_type, | 398 WindowContainerType container_type, |
397 const GURL& target_url, | 399 const GURL& target_url, |
398 const content::Referrer& referrer, | 400 const content::Referrer& referrer, |
399 WindowOpenDisposition disposition, | 401 WindowOpenDisposition disposition, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 ScopedVector<content::NavigationThrottle> | 503 ScopedVector<content::NavigationThrottle> |
502 AwContentBrowserClient::CreateThrottlesForNavigation( | 504 AwContentBrowserClient::CreateThrottlesForNavigation( |
503 content::NavigationHandle* navigation_handle) { | 505 content::NavigationHandle* navigation_handle) { |
504 ScopedVector<content::NavigationThrottle> throttles; | 506 ScopedVector<content::NavigationThrottle> throttles; |
505 if (navigation_handle->IsInMainFrame() || | 507 if (navigation_handle->IsInMainFrame() || |
506 (!navigation_handle->GetURL().SchemeIs(url::kHttpScheme) && | 508 (!navigation_handle->GetURL().SchemeIs(url::kHttpScheme) && |
507 !navigation_handle->GetURL().SchemeIs(url::kHttpsScheme) && | 509 !navigation_handle->GetURL().SchemeIs(url::kHttpsScheme) && |
508 !navigation_handle->GetURL().SchemeIs(url::kAboutScheme))) { | 510 !navigation_handle->GetURL().SchemeIs(url::kAboutScheme))) { |
509 throttles.push_back( | 511 throttles.push_back( |
510 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( | 512 navigation_interception::InterceptNavigationDelegate::CreateThrottleFor( |
511 navigation_handle) | 513 navigation_handle)); |
512 .Pass()); | |
513 } | 514 } |
514 return throttles.Pass(); | 515 return throttles; |
515 } | 516 } |
516 | 517 |
517 #if defined(VIDEO_HOLE) | 518 #if defined(VIDEO_HOLE) |
518 content::ExternalVideoSurfaceContainer* | 519 content::ExternalVideoSurfaceContainer* |
519 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( | 520 AwContentBrowserClient::OverrideCreateExternalVideoSurfaceContainer( |
520 content::WebContents* web_contents) { | 521 content::WebContents* web_contents) { |
521 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); | 522 return native_factory_->CreateExternalVideoSurfaceContainer(web_contents); |
522 } | 523 } |
523 #endif | 524 #endif |
524 | 525 |
525 } // namespace android_webview | 526 } // namespace android_webview |
OLD | NEW |