| 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 <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 if (!tab) { | 1281 if (!tab) { |
| 1282 NOTREACHED(); | 1282 NOTREACHED(); |
| 1283 return; | 1283 return; |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 GURL requesting_url("https://" + cert_request_info->host_and_port); | 1286 GURL requesting_url("https://" + cert_request_info->host_and_port); |
| 1287 DCHECK(requesting_url.is_valid()) << "Invalid URL string: https://" | 1287 DCHECK(requesting_url.is_valid()) << "Invalid URL string: https://" |
| 1288 << cert_request_info->host_and_port; | 1288 << cert_request_info->host_and_port; |
| 1289 | 1289 |
| 1290 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 1290 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 1291 scoped_ptr<Value> filter( | 1291 if (!cert_request_info->no_client_certs) { |
| 1292 profile->GetHostContentSettingsMap()->GetWebsiteSetting( | 1292 scoped_ptr<Value> filter( |
| 1293 requesting_url, | 1293 profile->GetHostContentSettingsMap()->GetWebsiteSetting( |
| 1294 requesting_url, | 1294 requesting_url, |
| 1295 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 1295 requesting_url, |
| 1296 std::string(), NULL)); | 1296 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 1297 std::string(), NULL)); |
| 1297 | 1298 |
| 1298 if (filter.get()) { | 1299 if (filter.get()) { |
| 1299 // Try to automatically select a client certificate. | 1300 // Try to automatically select a client certificate. |
| 1300 if (filter->IsType(Value::TYPE_DICTIONARY)) { | 1301 if (filter->IsType(Value::TYPE_DICTIONARY)) { |
| 1301 DictionaryValue* filter_dict = | 1302 DictionaryValue* filter_dict = |
| 1302 static_cast<DictionaryValue*>(filter.get()); | 1303 static_cast<DictionaryValue*>(filter.get()); |
| 1303 | 1304 |
| 1304 const std::vector<scoped_refptr<net::X509Certificate> >& | 1305 const std::vector<scoped_refptr<net::X509Certificate> >& |
| 1305 all_client_certs = cert_request_info->client_certs; | 1306 all_client_certs = cert_request_info->client_certs; |
| 1306 for (size_t i = 0; i < all_client_certs.size(); ++i) { | 1307 for (size_t i = 0; i < all_client_certs.size(); ++i) { |
| 1307 if (CertMatchesFilter(*all_client_certs[i], *filter_dict)) { | 1308 if (CertMatchesFilter(*all_client_certs[i], *filter_dict)) { |
| 1308 // Use the first certificate that is matched by the filter. | 1309 // Use the first certificate that is matched by the filter. |
| 1309 callback.Run(all_client_certs[i]); | 1310 callback.Run(all_client_certs[i]); |
| 1310 return; | 1311 return; |
| 1312 } |
| 1311 } | 1313 } |
| 1314 } else { |
| 1315 NOTREACHED(); |
| 1312 } | 1316 } |
| 1313 } else { | |
| 1314 NOTREACHED(); | |
| 1315 } | 1317 } |
| 1316 } | 1318 } |
| 1317 | 1319 |
| 1318 SSLTabHelper* ssl_tab_helper = SSLTabHelper::FromWebContents(tab); | 1320 SSLTabHelper* ssl_tab_helper = SSLTabHelper::FromWebContents(tab); |
| 1319 if (!ssl_tab_helper) { | 1321 if (!ssl_tab_helper) { |
| 1320 // If there is no SSLTabHelper for the given WebContents then we can't | 1322 // If there is no SSLTabHelper for the given WebContents then we can't |
| 1321 // show the user a dialog to select a client certificate. So we simply | 1323 // show the user a dialog to select a client certificate. So we simply |
| 1322 // proceed with no client certificate. | 1324 // proceed with no client certificate. |
| 1323 callback.Run(NULL); | 1325 callback.Run(NULL); |
| 1324 return; | 1326 return; |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 io_thread_application_locale_ = locale; | 1932 io_thread_application_locale_ = locale; |
| 1931 } | 1933 } |
| 1932 | 1934 |
| 1933 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( | 1935 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( |
| 1934 const std::string& locale) { | 1936 const std::string& locale) { |
| 1935 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1937 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1936 io_thread_application_locale_ = locale; | 1938 io_thread_application_locale_ = locale; |
| 1937 } | 1939 } |
| 1938 | 1940 |
| 1939 } // namespace chrome | 1941 } // namespace chrome |
| OLD | NEW |