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

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

Issue 18121007: *WIP* Store NSS slots per profile. Move keygen to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanups, add test for chrome keygen class Created 7 years, 3 months 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 #if defined(OS_CHROMEOS) 89 #if defined(OS_CHROMEOS)
90 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" 90 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h"
91 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" 91 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h"
92 #include "chrome/browser/chromeos/settings/cros_settings.h" 92 #include "chrome/browser/chromeos/settings/cros_settings.h"
93 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 93 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
94 #include "chrome/browser/policy/profile_policy_connector.h" 94 #include "chrome/browser/policy/profile_policy_connector.h"
95 #include "chrome/browser/policy/profile_policy_connector_factory.h" 95 #include "chrome/browser/policy/profile_policy_connector_factory.h"
96 #endif // defined(OS_CHROMEOS) 96 #endif // defined(OS_CHROMEOS)
97 97
98 #if defined(USE_NSS)
99 #include "chrome/browser/net/nss_slot_factory.h"
100 #endif
101
98 using content::BrowserContext; 102 using content::BrowserContext;
99 using content::BrowserThread; 103 using content::BrowserThread;
100 using content::ResourceContext; 104 using content::ResourceContext;
101 105
102 namespace { 106 namespace {
103 107
104 // ---------------------------------------------------------------------------- 108 // ----------------------------------------------------------------------------
105 // CookieMonster::Delegate implementation 109 // CookieMonster::Delegate implementation
106 // ---------------------------------------------------------------------------- 110 // ----------------------------------------------------------------------------
107 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { 111 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 profile->GetProxyConfigTracker())); 294 profile->GetProxyConfigTracker()));
291 #if defined(ENABLE_MANAGED_USERS) 295 #if defined(ENABLE_MANAGED_USERS)
292 ManagedUserService* managed_user_service = 296 ManagedUserService* managed_user_service =
293 ManagedUserServiceFactory::GetForProfile(profile); 297 ManagedUserServiceFactory::GetForProfile(profile);
294 params->managed_mode_url_filter = 298 params->managed_mode_url_filter =
295 managed_user_service->GetURLFilterForIOThread(); 299 managed_user_service->GetURLFilterForIOThread();
296 #endif 300 #endif
297 #if defined(OS_CHROMEOS) 301 #if defined(OS_CHROMEOS)
298 params->cert_verifier = CreatePolicyCertVerifier(profile); 302 params->cert_verifier = CreatePolicyCertVerifier(profile);
299 #endif 303 #endif
304 #if defined(USE_NSS)
305 params->public_slot = NSSSlotFactory::GetPublicSlotForBrowserContext(profile);
306 params->private_slot =
307 NSSSlotFactory::GetPrivateSlotForBrowserContext(profile);
308 #endif
300 309
301 params->profile = profile; 310 params->profile = profile;
302 profile_params_.reset(params.release()); 311 profile_params_.reset(params.release());
303 312
304 ChromeNetworkDelegate::InitializePrefsOnUIThread( 313 ChromeNetworkDelegate::InitializePrefsOnUIThread(
305 &enable_referrers_, 314 &enable_referrers_,
306 &enable_do_not_track_, 315 &enable_do_not_track_,
307 &force_safesearch_, 316 &force_safesearch_,
308 pref_service); 317 pref_service);
309 318
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 return host_content_settings_map_.get(); 645 return host_content_settings_map_.get();
637 } 646 }
638 647
639 #if defined(ENABLE_NOTIFICATIONS) 648 #if defined(ENABLE_NOTIFICATIONS)
640 DesktopNotificationService* ProfileIOData::GetNotificationService() const { 649 DesktopNotificationService* ProfileIOData::GetNotificationService() const {
641 DCHECK(initialized_); 650 DCHECK(initialized_);
642 return notification_service_; 651 return notification_service_;
643 } 652 }
644 #endif 653 #endif
645 654
655 #if defined(USE_NSS)
656 crypto::ScopedPK11Slot ProfileIOData::GetPublicNSSKeySlot() const {
657 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(public_slot_.get()));
658 }
659
660 crypto::ScopedPK11Slot ProfileIOData::GetPrivateNSSKeySlot() const {
661 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(private_slot_.get()));
662 }
663 #endif
664
646 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { 665 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() {
647 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 666 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
648 #if defined(OS_CHROMEOS) 667 #if defined(OS_CHROMEOS)
649 // Just fetch the value from ChromeOS' settings while we're on the UI thread. 668 // Just fetch the value from ChromeOS' settings while we're on the UI thread.
650 // TODO(stevet): For now, this value is only set on profile initialization. 669 // TODO(stevet): For now, this value is only set on profile initialization.
651 // We will want to do something similar to the PrefMember method below in the 670 // We will want to do something similar to the PrefMember method below in the
652 // future to more accurately capture this state. 671 // future to more accurately capture this state.
653 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, 672 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref,
654 &enable_metrics_); 673 &enable_metrics_);
655 #elif defined(OS_ANDROID) 674 #elif defined(OS_ANDROID)
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 #endif 842 #endif
824 843
825 #if defined(OS_CHROMEOS) 844 #if defined(OS_CHROMEOS)
826 profile_params_->cert_verifier->InitializeOnIOThread(); 845 profile_params_->cert_verifier->InitializeOnIOThread();
827 cert_verifier_ = profile_params_->cert_verifier.Pass(); 846 cert_verifier_ = profile_params_->cert_verifier.Pass();
828 main_request_context_->set_cert_verifier(cert_verifier_.get()); 847 main_request_context_->set_cert_verifier(cert_verifier_.get());
829 #else 848 #else
830 main_request_context_->set_cert_verifier( 849 main_request_context_->set_cert_verifier(
831 io_thread_globals->cert_verifier.get()); 850 io_thread_globals->cert_verifier.get());
832 #endif 851 #endif
852 #if defined(USE_NSS)
853 public_slot_ = profile_params_->public_slot.Pass();
854 private_slot_ = profile_params_->private_slot.Pass();
855 #endif
833 856
834 InitializeInternal(profile_params_.get(), protocol_handlers); 857 InitializeInternal(profile_params_.get(), protocol_handlers);
835 858
836 profile_params_.reset(); 859 profile_params_.reset();
837 initialized_ = true; 860 initialized_ = true;
838 } 861 }
839 862
840 void ProfileIOData::ApplyProfileParamsToContext( 863 void ProfileIOData::ApplyProfileParamsToContext(
841 ChromeURLRequestContext* context) const { 864 ChromeURLRequestContext* context) const {
842 context->set_http_user_agent_settings( 865 context->set_http_user_agent_settings(
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void ProfileIOData::SetCookieSettingsForTesting( 999 void ProfileIOData::SetCookieSettingsForTesting(
977 CookieSettings* cookie_settings) { 1000 CookieSettings* cookie_settings) {
978 DCHECK(!cookie_settings_.get()); 1001 DCHECK(!cookie_settings_.get());
979 cookie_settings_ = cookie_settings; 1002 cookie_settings_ = cookie_settings;
980 } 1003 }
981 1004
982 void ProfileIOData::set_signin_names_for_testing( 1005 void ProfileIOData::set_signin_names_for_testing(
983 SigninNamesOnIOThread* signin_names) { 1006 SigninNamesOnIOThread* signin_names) {
984 signin_names_.reset(signin_names); 1007 signin_names_.reset(signin_names);
985 } 1008 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698