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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2379 new CertificateReportingServiceCertReporter(cert_reporting_service)); | 2379 new CertificateReportingServiceCertReporter(cert_reporting_service)); |
2380 | 2380 |
2381 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, | 2381 SSLErrorHandler::HandleSSLError(web_contents, cert_error, ssl_info, |
2382 request_url, options_mask, | 2382 request_url, options_mask, |
2383 std::move(cert_reporter), callback); | 2383 std::move(cert_reporter), callback); |
2384 } | 2384 } |
2385 | 2385 |
2386 void ChromeContentBrowserClient::SelectClientCertificate( | 2386 void ChromeContentBrowserClient::SelectClientCertificate( |
2387 content::WebContents* web_contents, | 2387 content::WebContents* web_contents, |
2388 net::SSLCertRequestInfo* cert_request_info, | 2388 net::SSLCertRequestInfo* cert_request_info, |
| 2389 net::CertificateList client_certs, |
2389 std::unique_ptr<content::ClientCertificateDelegate> delegate) { | 2390 std::unique_ptr<content::ClientCertificateDelegate> delegate) { |
2390 prerender::PrerenderContents* prerender_contents = | 2391 prerender::PrerenderContents* prerender_contents = |
2391 prerender::PrerenderContents::FromWebContents(web_contents); | 2392 prerender::PrerenderContents::FromWebContents(web_contents); |
2392 if (prerender_contents) { | 2393 if (prerender_contents) { |
2393 prerender_contents->Destroy( | 2394 prerender_contents->Destroy( |
2394 prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED); | 2395 prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED); |
2395 return; | 2396 return; |
2396 } | 2397 } |
2397 | 2398 |
2398 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); | 2399 GURL requesting_url("https://" + cert_request_info->host_and_port.ToString()); |
2399 DCHECK(requesting_url.is_valid()) | 2400 DCHECK(requesting_url.is_valid()) |
2400 << "Invalid URL string: https://" | 2401 << "Invalid URL string: https://" |
2401 << cert_request_info->host_and_port.ToString(); | 2402 << cert_request_info->host_and_port.ToString(); |
2402 | 2403 |
2403 Profile* profile = | 2404 Profile* profile = |
2404 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 2405 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
2405 std::unique_ptr<base::Value> filter = | 2406 std::unique_ptr<base::Value> filter = |
2406 HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting( | 2407 HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting( |
2407 requesting_url, requesting_url, | 2408 requesting_url, requesting_url, |
2408 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), NULL); | 2409 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, std::string(), NULL); |
2409 | 2410 |
2410 if (filter.get()) { | 2411 if (filter.get()) { |
2411 // Try to automatically select a client certificate. | 2412 // Try to automatically select a client certificate. |
2412 if (filter->IsType(base::Value::Type::DICTIONARY)) { | 2413 if (filter->IsType(base::Value::Type::DICTIONARY)) { |
2413 base::DictionaryValue* filter_dict = | 2414 base::DictionaryValue* filter_dict = |
2414 static_cast<base::DictionaryValue*>(filter.get()); | 2415 static_cast<base::DictionaryValue*>(filter.get()); |
2415 | 2416 |
2416 const std::vector<scoped_refptr<net::X509Certificate> >& | 2417 for (size_t i = 0; i < client_certs.size(); ++i) { |
2417 all_client_certs = cert_request_info->client_certs; | 2418 if (CertMatchesFilter(*client_certs[i].get(), *filter_dict)) { |
2418 for (size_t i = 0; i < all_client_certs.size(); ++i) { | |
2419 if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) { | |
2420 // Use the first certificate that is matched by the filter. | 2419 // Use the first certificate that is matched by the filter. |
2421 delegate->ContinueWithCertificate(all_client_certs[i].get()); | 2420 delegate->ContinueWithCertificate(client_certs[i].get()); |
2422 return; | 2421 return; |
2423 } | 2422 } |
2424 } | 2423 } |
2425 } else { | 2424 } else { |
2426 NOTREACHED(); | 2425 NOTREACHED(); |
2427 } | 2426 } |
2428 } | 2427 } |
2429 | 2428 |
2430 chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info, | 2429 chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info, |
| 2430 std::move(client_certs), |
2431 std::move(delegate)); | 2431 std::move(delegate)); |
2432 } | 2432 } |
2433 | 2433 |
2434 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { | 2434 content::MediaObserver* ChromeContentBrowserClient::GetMediaObserver() { |
2435 return MediaCaptureDevicesDispatcher::GetInstance(); | 2435 return MediaCaptureDevicesDispatcher::GetInstance(); |
2436 } | 2436 } |
2437 | 2437 |
2438 content::PlatformNotificationService* | 2438 content::PlatformNotificationService* |
2439 ChromeContentBrowserClient::GetPlatformNotificationService() { | 2439 ChromeContentBrowserClient::GetPlatformNotificationService() { |
2440 return PlatformNotificationServiceImpl::GetInstance(); | 2440 return PlatformNotificationServiceImpl::GetInstance(); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3611 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { | 3611 RedirectNonUINonIOBrowserThreadsToTaskScheduler() { |
3612 return variations::GetVariationParamValue( | 3612 return variations::GetVariationParamValue( |
3613 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; | 3613 "BrowserScheduler", "RedirectNonUINonIOBrowserThreads") == "true"; |
3614 } | 3614 } |
3615 | 3615 |
3616 // static | 3616 // static |
3617 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( | 3617 void ChromeContentBrowserClient::SetDefaultQuotaSettingsForTesting( |
3618 const storage::QuotaSettings* settings) { | 3618 const storage::QuotaSettings* settings) { |
3619 g_default_quota_settings = settings; | 3619 g_default_quota_settings = settings; |
3620 } | 3620 } |
OLD | NEW |