Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 61643007: Update keygen to use correct NSS slot on ChromeOS multiprofile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase to 238776 Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/client_cert_store_impl.h" 75 #include "net/ssl/client_cert_store_impl.h"
(...skipping 21 matching lines...) Expand all
96 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" 97 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h"
97 #include "chrome/browser/chromeos/settings/cros_settings.h" 98 #include "chrome/browser/chromeos/settings/cros_settings.h"
98 #include "chromeos/dbus/cryptohome_client.h" 99 #include "chromeos/dbus/cryptohome_client.h"
99 #include "chromeos/dbus/dbus_thread_manager.h" 100 #include "chromeos/dbus/dbus_thread_manager.h"
100 #include "chromeos/settings/cros_settings_names.h" 101 #include "chromeos/settings/cros_settings_names.h"
101 #include "crypto/nss_util.h" 102 #include "crypto/nss_util.h"
102 #include "crypto/nss_util_internal.h" 103 #include "crypto/nss_util_internal.h"
103 #endif // defined(OS_CHROMEOS) 104 #endif // defined(OS_CHROMEOS)
104 105
105 #if defined(USE_NSS) 106 #if defined(USE_NSS)
106 #include "chrome/browser/ui/crypto_module_password_dialog.h" 107 #include "chrome/browser/ui/crypto_module_delegate_nss.h"
107 #endif 108 #endif
108 109
109 using content::BrowserContext; 110 using content::BrowserContext;
110 using content::BrowserThread; 111 using content::BrowserThread;
111 using content::ResourceContext; 112 using content::ResourceContext;
112 113
113 namespace { 114 namespace {
114 115
115 // ---------------------------------------------------------------------------- 116 // ----------------------------------------------------------------------------
116 // CookieMonster::Delegate implementation 117 // CookieMonster::Delegate implementation
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 DCHECK(io_data_->initialized_); 820 DCHECK(io_data_->initialized_);
820 return request_context_; 821 return request_context_;
821 } 822 }
822 823
823 scoped_ptr<net::ClientCertStore> 824 scoped_ptr<net::ClientCertStore>
824 ProfileIOData::ResourceContext::CreateClientCertStore() { 825 ProfileIOData::ResourceContext::CreateClientCertStore() {
825 #if !defined(USE_OPENSSL) 826 #if !defined(USE_OPENSSL)
826 scoped_ptr<net::ClientCertStoreImpl> store(new net::ClientCertStoreImpl()); 827 scoped_ptr<net::ClientCertStoreImpl> store(new net::ClientCertStoreImpl());
827 #if defined(USE_NSS) 828 #if defined(USE_NSS)
828 store->set_password_delegate_factory( 829 store->set_password_delegate_factory(
829 base::Bind(&chrome::NewCryptoModuleBlockingDialogDelegate, 830 base::Bind(&chrome::CreateCryptoModuleBlockingPasswordDelegate,
830 chrome::kCryptoModulePasswordClientAuth)); 831 chrome::kCryptoModulePasswordClientAuth));
831 #endif 832 #endif
832 return store.PassAs<net::ClientCertStore>(); 833 return store.PassAs<net::ClientCertStore>();
833 #else // defined(USE_OPENSSL) 834 #else // defined(USE_OPENSSL)
834 // OpenSSL does not use the ClientCertStore infrastructure. On Android client 835 // OpenSSL does not use the ClientCertStore infrastructure. On Android client
835 // cert matching is done by the OS as part of the call to show the cert 836 // cert matching is done by the OS as part of the call to show the cert
836 // selection dialog. 837 // selection dialog.
837 return scoped_ptr<net::ClientCertStore>(); 838 return scoped_ptr<net::ClientCertStore>();
838 #endif 839 #endif
839 } 840 }
840 841
842 scoped_ptr<net::KeygenHandler>
843 ProfileIOData::ResourceContext::CreateKeygenHandler(
844 uint32 key_size_in_bits,
845 const std::string& challenge_string,
846 const GURL& url,
847 const base::Callback<void(scoped_ptr<net::KeygenHandler>)>& callback) {
848 DCHECK(!callback.is_null());
849 scoped_ptr<net::KeygenHandler> keygen_handler(
850 new net::KeygenHandler(key_size_in_bits, challenge_string, url));
851
852 #if defined(USE_NSS)
853 scoped_ptr<ChromeNSSCryptoModuleDelegate> delegate(
854 new ChromeNSSCryptoModuleDelegate(chrome::kCryptoModulePasswordKeygen,
855 url.host()));
856 ChromeNSSCryptoModuleDelegate* delegate_ptr = delegate.get();
857 keygen_handler->set_crypto_module_delegate(
858 delegate.PassAs<crypto::NSSCryptoModuleDelegate>());
859
860 if (delegate_ptr->InitializeSlot(this, base::Closure()))
861 return keygen_handler.Pass();
862
863 bool rv = delegate_ptr->InitializeSlot(
864 this, base::Bind(callback, base::Passed(&keygen_handler)));
865 DCHECK(!rv);
Ryan Sleevi 2013/12/05 00:23:19 I still find the async setup here a little weird.
mattm 2013/12/05 00:42:44 Yeah, this is weird. The problem is the base::Pass
mattm 2013/12/05 00:46:48 Oh yeah, the problem with that approach is that th
Ryan Sleevi 2013/12/05 01:05:54 I feel like you can avoid this by avoiding the bas
mattm 2013/12/05 04:41:25 Ah, yeah. I've done that (though just using Owned
866 return scoped_ptr<net::KeygenHandler>();
867 #else
868 return keygen_handler.Pass();
869 #endif
870 }
871
841 bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) { 872 bool ProfileIOData::ResourceContext::AllowMicAccess(const GURL& origin) {
842 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC); 873 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
843 } 874 }
844 875
845 bool ProfileIOData::ResourceContext::AllowCameraAccess(const GURL& origin) { 876 bool ProfileIOData::ResourceContext::AllowCameraAccess(const GURL& origin) {
846 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); 877 return AllowContentAccess(origin, CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA);
847 } 878 }
848 879
849 bool ProfileIOData::ResourceContext::AllowContentAccess( 880 bool ProfileIOData::ResourceContext::AllowContentAccess(
850 const GURL& origin, ContentSettingsType type) { 881 const GURL& origin, ContentSettingsType type) {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void ProfileIOData::SetCookieSettingsForTesting( 1149 void ProfileIOData::SetCookieSettingsForTesting(
1119 CookieSettings* cookie_settings) { 1150 CookieSettings* cookie_settings) {
1120 DCHECK(!cookie_settings_.get()); 1151 DCHECK(!cookie_settings_.get());
1121 cookie_settings_ = cookie_settings; 1152 cookie_settings_ = cookie_settings;
1122 } 1153 }
1123 1154
1124 void ProfileIOData::set_signin_names_for_testing( 1155 void ProfileIOData::set_signin_names_for_testing(
1125 SigninNamesOnIOThread* signin_names) { 1156 SigninNamesOnIOThread* signin_names) {
1126 signin_names_.reset(signin_names); 1157 signin_names_.reset(signin_names);
1127 } 1158 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698