Chromium Code Reviews| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 #include "content/public/common/url_utils.h" | 133 #include "content/public/common/url_utils.h" |
| 134 #include "content/public/common/web_preferences.h" | 134 #include "content/public/common/web_preferences.h" |
| 135 #include "device/devices_app/public/cpp/constants.h" | 135 #include "device/devices_app/public/cpp/constants.h" |
| 136 #include "device/devices_app/public/cpp/devices_app_factory.h" | 136 #include "device/devices_app/public/cpp/devices_app_factory.h" |
| 137 #include "gin/v8_initializer.h" | 137 #include "gin/v8_initializer.h" |
| 138 #include "mojo/application/public/cpp/application_delegate.h" | 138 #include "mojo/application/public/cpp/application_delegate.h" |
| 139 #include "net/base/mime_util.h" | 139 #include "net/base/mime_util.h" |
| 140 #include "net/cookies/canonical_cookie.h" | 140 #include "net/cookies/canonical_cookie.h" |
| 141 #include "net/cookies/cookie_options.h" | 141 #include "net/cookies/cookie_options.h" |
| 142 #include "net/ssl/ssl_cert_request_info.h" | 142 #include "net/ssl/ssl_cert_request_info.h" |
| 143 #include "net/ssl/ssl_platform_key.h" | |
| 143 #include "ppapi/host/ppapi_host.h" | 144 #include "ppapi/host/ppapi_host.h" |
| 144 #include "storage/browser/fileapi/external_mount_points.h" | 145 #include "storage/browser/fileapi/external_mount_points.h" |
| 145 #include "ui/base/l10n/l10n_util.h" | 146 #include "ui/base/l10n/l10n_util.h" |
| 146 #include "ui/base/resource/resource_bundle.h" | 147 #include "ui/base/resource/resource_bundle.h" |
| 147 #include "ui/resources/grit/ui_resources.h" | 148 #include "ui/resources/grit/ui_resources.h" |
| 148 | 149 |
| 149 #if defined(OS_WIN) | 150 #if defined(OS_WIN) |
| 150 #include "base/win/windows_version.h" | 151 #include "base/win/windows_version.h" |
| 151 #include "chrome/browser/chrome_browser_main_win.h" | 152 #include "chrome/browser/chrome_browser_main_win.h" |
| 152 #include "sandbox/win/src/sandbox_policy.h" | 153 #include "sandbox/win/src/sandbox_policy.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 | 429 |
| 429 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to | 430 // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to |
| 430 // "chrome://foo/". | 431 // "chrome://foo/". |
| 431 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { | 432 bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { |
| 432 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) | 433 if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) |
| 433 return false; | 434 return false; |
| 434 | 435 |
| 435 return RemoveUberHost(url); | 436 return RemoveUberHost(url); |
| 436 } | 437 } |
| 437 | 438 |
| 439 #if !defined(OS_ANDROID) | |
| 438 bool CertMatchesFilter(const net::X509Certificate& cert, | 440 bool CertMatchesFilter(const net::X509Certificate& cert, |
| 439 const base::DictionaryValue& filter) { | 441 const base::DictionaryValue& filter) { |
| 440 // TODO(markusheintz): This is the minimal required filter implementation. | 442 // TODO(markusheintz): This is the minimal required filter implementation. |
| 441 // Implement a better matcher. | 443 // Implement a better matcher. |
| 442 | 444 |
| 443 // An empty filter matches any client certificate since no requirements are | 445 // An empty filter matches any client certificate since no requirements are |
| 444 // specified at all. | 446 // specified at all. |
| 445 if (filter.empty()) | 447 if (filter.empty()) |
| 446 return true; | 448 return true; |
| 447 | 449 |
| 448 std::string common_name; | 450 std::string common_name; |
| 449 if (filter.GetString("ISSUER.CN", &common_name) && | 451 if (filter.GetString("ISSUER.CN", &common_name) && |
| 450 (cert.issuer().common_name == common_name)) { | 452 (cert.issuer().common_name == common_name)) { |
| 451 return true; | 453 return true; |
| 452 } | 454 } |
| 453 return false; | 455 return false; |
| 454 } | 456 } |
| 457 #endif | |
| 455 | 458 |
| 456 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 459 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 457 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( | 460 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( |
| 458 const std::string& process_type) { | 461 const std::string& process_type) { |
| 459 base::FilePath dumps_path; | 462 base::FilePath dumps_path; |
| 460 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 463 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
| 461 { | 464 { |
| 462 ANNOTATE_SCOPED_MEMORY_LEAK; | 465 ANNOTATE_SCOPED_MEMORY_LEAK; |
| 463 bool upload = (getenv(env_vars::kHeadless) == NULL); | 466 bool upload = (getenv(env_vars::kHeadless) == NULL); |
| 464 breakpad::CrashHandlerHostLinux* crash_handler = | 467 breakpad::CrashHandlerHostLinux* crash_handler = |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1960 | 1963 |
| 1961 Profile* profile = | 1964 Profile* profile = |
| 1962 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1965 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 1963 scoped_ptr<base::Value> filter = | 1966 scoped_ptr<base::Value> filter = |
| 1964 HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting( | 1967 HostContentSettingsMapFactory::GetForProfile(profile)->GetWebsiteSetting( |
| 1965 requesting_url, | 1968 requesting_url, |
| 1966 requesting_url, | 1969 requesting_url, |
| 1967 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 1970 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 1968 std::string(), | 1971 std::string(), |
| 1969 NULL); | 1972 NULL); |
| 1970 | 1973 |
|
davidben
2015/10/13 20:32:15
Probably add a comment to the #ifdef that Android
svaldez
2015/10/14 15:06:18
Done.
| |
| 1974 #if !defined(OS_ANDROID) | |
|
davidben
2015/10/13 20:32:15
Nit: Move this up to line 1958 I think.
svaldez
2015/10/14 15:06:18
Done.
| |
| 1971 if (filter.get()) { | 1975 if (filter.get()) { |
| 1972 // Try to automatically select a client certificate. | 1976 // Try to automatically select a client certificate. |
| 1973 if (filter->IsType(base::Value::TYPE_DICTIONARY)) { | 1977 if (filter->IsType(base::Value::TYPE_DICTIONARY)) { |
| 1974 base::DictionaryValue* filter_dict = | 1978 base::DictionaryValue* filter_dict = |
| 1975 static_cast<base::DictionaryValue*>(filter.get()); | 1979 static_cast<base::DictionaryValue*>(filter.get()); |
| 1976 | 1980 |
| 1977 const std::vector<scoped_refptr<net::X509Certificate> >& | 1981 const std::vector<scoped_refptr<net::X509Certificate> >& |
| 1978 all_client_certs = cert_request_info->client_certs; | 1982 all_client_certs = cert_request_info->client_certs; |
| 1979 for (size_t i = 0; i < all_client_certs.size(); ++i) { | 1983 for (size_t i = 0; i < all_client_certs.size(); ++i) { |
| 1980 if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) { | 1984 if (CertMatchesFilter(*all_client_certs[i].get(), *filter_dict)) { |
| 1981 // Use the first certificate that is matched by the filter. | 1985 // Use the first certificate that is matched by the filter. |
| 1982 delegate->ContinueWithCertificate(all_client_certs[i].get()); | 1986 // The following is not supported on Android since the client_certs |
| 1987 // list | |
| 1988 // won't be populated. | |
| 1989 delegate->ContinueWithCertificate( | |
| 1990 all_client_certs[i].get(), | |
| 1991 FetchClientCertPrivateKey(all_client_certs[i].get()).get()); | |
|
davidben
2015/10/13 20:32:15
net:: prefix. Ugh, I bet this is compiling because
svaldez
2015/10/14 15:06:18
Done.
| |
| 1983 return; | 1992 return; |
| 1984 } | 1993 } |
| 1985 } | 1994 } |
| 1986 } else { | 1995 } else { |
| 1987 NOTREACHED(); | 1996 NOTREACHED(); |
| 1988 } | 1997 } |
| 1989 } | 1998 } |
| 1999 #endif | |
| 1990 | 2000 |
| 1991 chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info, | 2001 chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info, |
| 1992 delegate.Pass()); | 2002 delegate.Pass()); |
| 1993 } | 2003 } |
| 1994 | 2004 |
| 1995 void ChromeContentBrowserClient::AddCertificate( | 2005 void ChromeContentBrowserClient::AddCertificate( |
| 1996 net::CertificateMimeType cert_type, | 2006 net::CertificateMimeType cert_type, |
| 1997 const void* cert_data, | 2007 const void* cert_data, |
| 1998 size_t cert_size, | 2008 size_t cert_size, |
| 1999 int render_process_id, | 2009 int render_process_id, |
| (...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2669 if (channel <= kMaxDisableEncryptionChannel) { | 2679 if (channel <= kMaxDisableEncryptionChannel) { |
| 2670 static const char* const kWebRtcDevSwitchNames[] = { | 2680 static const char* const kWebRtcDevSwitchNames[] = { |
| 2671 switches::kDisableWebRtcEncryption, | 2681 switches::kDisableWebRtcEncryption, |
| 2672 }; | 2682 }; |
| 2673 to_command_line->CopySwitchesFrom(from_command_line, | 2683 to_command_line->CopySwitchesFrom(from_command_line, |
| 2674 kWebRtcDevSwitchNames, | 2684 kWebRtcDevSwitchNames, |
| 2675 arraysize(kWebRtcDevSwitchNames)); | 2685 arraysize(kWebRtcDevSwitchNames)); |
| 2676 } | 2686 } |
| 2677 } | 2687 } |
| 2678 #endif // defined(ENABLE_WEBRTC) | 2688 #endif // defined(ENABLE_WEBRTC) |
| OLD | NEW |