| 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/profiles/profile_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #include "chrome/common/chrome_switches.h" | 55 #include "chrome/common/chrome_switches.h" |
| 56 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
| 57 #include "chrome/common/url_constants.h" | 57 #include "chrome/common/url_constants.h" |
| 58 #include "components/startup_metric_utils/startup_metric_utils.h" | 58 #include "components/startup_metric_utils/startup_metric_utils.h" |
| 59 #include "content/public/browser/browser_thread.h" | 59 #include "content/public/browser/browser_thread.h" |
| 60 #include "content/public/browser/host_zoom_map.h" | 60 #include "content/public/browser/host_zoom_map.h" |
| 61 #include "content/public/browser/notification_service.h" | 61 #include "content/public/browser/notification_service.h" |
| 62 #include "content/public/browser/resource_context.h" | 62 #include "content/public/browser/resource_context.h" |
| 63 #include "extensions/browser/info_map.h" | 63 #include "extensions/browser/info_map.h" |
| 64 #include "extensions/common/constants.h" | 64 #include "extensions/common/constants.h" |
| 65 #include "net/base/keygen_handler.h" |
| 65 #include "net/cookies/canonical_cookie.h" | 66 #include "net/cookies/canonical_cookie.h" |
| 66 #include "net/cookies/cookie_monster.h" | 67 #include "net/cookies/cookie_monster.h" |
| 67 #include "net/http/http_transaction_factory.h" | 68 #include "net/http/http_transaction_factory.h" |
| 68 #include "net/http/http_util.h" | 69 #include "net/http/http_util.h" |
| 69 #include "net/http/transport_security_persister.h" | 70 #include "net/http/transport_security_persister.h" |
| 70 #include "net/proxy/proxy_config_service_fixed.h" | 71 #include "net/proxy/proxy_config_service_fixed.h" |
| 71 #include "net/proxy/proxy_script_fetcher_impl.h" | 72 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 72 #include "net/proxy/proxy_service.h" | 73 #include "net/proxy/proxy_service.h" |
| 73 #include "net/ssl/client_cert_store.h" | 74 #include "net/ssl/client_cert_store.h" |
| 74 #include "net/ssl/server_bound_cert_service.h" | 75 #include "net/ssl/server_bound_cert_service.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 103 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 104 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
| 104 #include "chrome/browser/chromeos/settings/cros_settings.h" | 105 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 105 #include "chromeos/dbus/cryptohome_client.h" | 106 #include "chromeos/dbus/cryptohome_client.h" |
| 106 #include "chromeos/dbus/dbus_thread_manager.h" | 107 #include "chromeos/dbus/dbus_thread_manager.h" |
| 107 #include "chromeos/settings/cros_settings_names.h" | 108 #include "chromeos/settings/cros_settings_names.h" |
| 108 #include "crypto/nss_util.h" | 109 #include "crypto/nss_util.h" |
| 109 #include "crypto/nss_util_internal.h" | 110 #include "crypto/nss_util_internal.h" |
| 110 #endif // defined(OS_CHROMEOS) | 111 #endif // defined(OS_CHROMEOS) |
| 111 | 112 |
| 112 #if defined(USE_NSS) | 113 #if defined(USE_NSS) |
| 113 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 114 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
| 114 #include "net/ssl/client_cert_store_nss.h" | 115 #include "net/ssl/client_cert_store_nss.h" |
| 115 #endif | 116 #endif |
| 116 | 117 |
| 117 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
| 118 #include "net/ssl/client_cert_store_win.h" | 119 #include "net/ssl/client_cert_store_win.h" |
| 119 #endif | 120 #endif |
| 120 | 121 |
| 121 #if defined(OS_MACOSX) | 122 #if defined(OS_MACOSX) |
| 122 #include "net/ssl/client_cert_store_mac.h" | 123 #include "net/ssl/client_cert_store_mac.h" |
| 123 #endif | 124 #endif |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { | 848 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { |
| 848 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 849 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 849 DCHECK(io_data_->initialized_); | 850 DCHECK(io_data_->initialized_); |
| 850 return request_context_; | 851 return request_context_; |
| 851 } | 852 } |
| 852 | 853 |
| 853 scoped_ptr<net::ClientCertStore> | 854 scoped_ptr<net::ClientCertStore> |
| 854 ProfileIOData::ResourceContext::CreateClientCertStore() { | 855 ProfileIOData::ResourceContext::CreateClientCertStore() { |
| 855 #if defined(USE_NSS) | 856 #if defined(USE_NSS) |
| 856 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( | 857 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( |
| 857 base::Bind(&chrome::NewCryptoModuleBlockingDialogDelegate, | 858 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, |
| 858 chrome::kCryptoModulePasswordClientAuth))); | 859 chrome::kCryptoModulePasswordClientAuth))); |
| 859 #elif defined(OS_WIN) | 860 #elif defined(OS_WIN) |
| 860 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); | 861 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); |
| 861 #elif defined(OS_MACOSX) | 862 #elif defined(OS_MACOSX) |
| 862 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); | 863 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreMac()); |
| 863 #elif defined(USE_OPENSSL) | 864 #elif defined(USE_OPENSSL) |
| 864 // OpenSSL does not use the ClientCertStore infrastructure. On Android client | 865 // OpenSSL does not use the ClientCertStore infrastructure. On Android client |
| 865 // cert matching is done by the OS as part of the call to show the cert | 866 // cert matching is done by the OS as part of the call to show the cert |
| 866 // selection dialog. | 867 // selection dialog. |
| 867 return scoped_ptr<net::ClientCertStore>(); | 868 return scoped_ptr<net::ClientCertStore>(); |
| 868 #else | 869 #else |
| 869 #error Unknown platform. | 870 #error Unknown platform. |
| 870 #endif | 871 #endif |
| 871 } | 872 } |
| 872 | 873 |
| 874 void ProfileIOData::ResourceContext::CreateKeygenHandler( |
| 875 uint32 key_size_in_bits, |
| 876 const std::string& challenge_string, |
| 877 const GURL& url, |
| 878 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) { |
| 879 DCHECK(!callback.is_null()); |
| 880 #if defined(USE_NSS) |
| 881 scoped_ptr<net::KeygenHandler> keygen_handler( |
| 882 new net::KeygenHandler(key_size_in_bits, challenge_string, url)); |
| 883 |
| 884 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate( |
| 885 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen, |
| 886 url.host())); |
| 887 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get(); |
| 888 keygen_handler->set_crypto_module_delegate( |
| 889 delegate.PassAs<crypto::NSSCryptoModuleDelegate>()); |
| 890 |
| 891 base::Closure bound_callback = |
| 892 base::Bind(callback, base::Passed(&keygen_handler)); |
| 893 if (delegate_ptr->InitializeSlot(this, bound_callback)) { |
| 894 // Initialization complete, run the callback synchronously. |
| 895 bound_callback.Run(); |
| 896 return; |
| 897 } |
| 898 // Otherwise, the InitializeSlot will run the callback asynchronously. |
| 899 #else |
| 900 callback.Run(make_scoped_ptr( |
| 901 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); |
| 902 #endif |
| 903 } |
| 904 |
| 873 bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) { | 905 bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) { |
| 874 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); | 906 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); |
| 875 } | 907 } |
| 876 | 908 |
| 877 bool ProfileIOData::ResourceContext::AllowCameraAccess(const GURL& origin) { | 909 bool ProfileIOData::ResourceContext::AllowCameraAccess(const GURL& origin) { |
| 878 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); | 910 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); |
| 879 } | 911 } |
| 880 | 912 |
| 881 bool ProfileIOData::ResourceContext::AllowContentAccess( | 913 bool ProfileIOData::ResourceContext::AllowContentAccess( |
| 882 const GURL& origin, ContentSettingsType type) { | 914 const GURL& origin, ContentSettingsType type) { |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 void ProfileIOData::SetCookieSettingsForTesting( | 1183 void ProfileIOData::SetCookieSettingsForTesting( |
| 1152 CookieSettings* cookie_settings) { | 1184 CookieSettings* cookie_settings) { |
| 1153 DCHECK(!cookie_settings_.get()); | 1185 DCHECK(!cookie_settings_.get()); |
| 1154 cookie_settings_ = cookie_settings; | 1186 cookie_settings_ = cookie_settings; |
| 1155 } | 1187 } |
| 1156 | 1188 |
| 1157 void ProfileIOData::set_signin_names_for_testing( | 1189 void ProfileIOData::set_signin_names_for_testing( |
| 1158 SigninNamesOnIOThread* signin_names) { | 1190 SigninNamesOnIOThread* signin_names) { |
| 1159 signin_names_.reset(signin_names); | 1191 signin_names_.reset(signin_names); |
| 1160 } | 1192 } |
| OLD | NEW |