| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
| 86 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 86 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
| 87 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 87 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
| 88 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 88 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 89 #include "chrome/browser/chromeos/settings/cros_settings.h" | 89 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 90 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 90 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 91 #include "chrome/browser/policy/browser_policy_connector.h" | 91 #include "chrome/browser/policy/browser_policy_connector.h" |
| 92 #endif // defined(OS_CHROMEOS) | 92 #endif // defined(OS_CHROMEOS) |
| 93 | 93 |
| 94 #if defined(USE_NSS) |
| 95 #include "chrome/browser/net/nss_slot_factory.h" |
| 96 #endif |
| 97 |
| 94 using content::BrowserContext; | 98 using content::BrowserContext; |
| 95 using content::BrowserThread; | 99 using content::BrowserThread; |
| 96 using content::ResourceContext; | 100 using content::ResourceContext; |
| 97 | 101 |
| 98 namespace { | 102 namespace { |
| 99 | 103 |
| 100 // ---------------------------------------------------------------------------- | 104 // ---------------------------------------------------------------------------- |
| 101 // CookieMonster::Delegate implementation | 105 // CookieMonster::Delegate implementation |
| 102 // ---------------------------------------------------------------------------- | 106 // ---------------------------------------------------------------------------- |
| 103 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { | 107 class ChromeCookieMonsterDelegate : public net::CookieMonster::Delegate { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 ManagedUserService* managed_user_service = | 273 ManagedUserService* managed_user_service = |
| 270 ManagedUserServiceFactory::GetForProfile(profile); | 274 ManagedUserServiceFactory::GetForProfile(profile); |
| 271 params->managed_mode_url_filter = | 275 params->managed_mode_url_filter = |
| 272 managed_user_service->GetURLFilterForIOThread(); | 276 managed_user_service->GetURLFilterForIOThread(); |
| 273 #endif | 277 #endif |
| 274 #if defined(OS_CHROMEOS) | 278 #if defined(OS_CHROMEOS) |
| 275 policy::BrowserPolicyConnector* connector = | 279 policy::BrowserPolicyConnector* connector = |
| 276 g_browser_process->browser_policy_connector(); | 280 g_browser_process->browser_policy_connector(); |
| 277 params->trust_anchor_provider = connector->GetCertTrustAnchorProvider(); | 281 params->trust_anchor_provider = connector->GetCertTrustAnchorProvider(); |
| 278 #endif | 282 #endif |
| 283 #if defined(USE_NSS) |
| 284 params->public_slot = |
| 285 chrome::NSSSlotFactory::GetPublicSlotForBrowserContext(profile); |
| 286 params->private_slot = |
| 287 chrome::NSSSlotFactory::GetPrivateSlotForBrowserContext(profile); |
| 288 #endif |
| 279 | 289 |
| 280 params->profile = profile; | 290 params->profile = profile; |
| 281 profile_params_.reset(params.release()); | 291 profile_params_.reset(params.release()); |
| 282 | 292 |
| 283 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 293 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 284 &enable_referrers_, | 294 &enable_referrers_, |
| 285 &enable_do_not_track_, | 295 &enable_do_not_track_, |
| 286 &force_safesearch_, | 296 &force_safesearch_, |
| 287 pref_service); | 297 pref_service); |
| 288 | 298 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 return cookie_settings_.get(); | 563 return cookie_settings_.get(); |
| 554 } | 564 } |
| 555 | 565 |
| 556 #if defined(ENABLE_NOTIFICATIONS) | 566 #if defined(ENABLE_NOTIFICATIONS) |
| 557 DesktopNotificationService* ProfileIOData::GetNotificationService() const { | 567 DesktopNotificationService* ProfileIOData::GetNotificationService() const { |
| 558 DCHECK(initialized_); | 568 DCHECK(initialized_); |
| 559 return notification_service_; | 569 return notification_service_; |
| 560 } | 570 } |
| 561 #endif | 571 #endif |
| 562 | 572 |
| 573 #if defined(USE_NSS) |
| 574 crypto::ScopedPK11Slot ProfileIOData::GetPublicNSSKeySlot() const { |
| 575 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(public_slot_.get())); |
| 576 } |
| 577 |
| 578 crypto::ScopedPK11Slot ProfileIOData::GetPrivateNSSKeySlot() const { |
| 579 return crypto::ScopedPK11Slot(PK11_ReferenceSlot(private_slot_.get())); |
| 580 } |
| 581 #endif |
| 582 |
| 563 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 583 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
| 564 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 584 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 565 #if defined(OS_CHROMEOS) | 585 #if defined(OS_CHROMEOS) |
| 566 // Just fetch the value from ChromeOS' settings while we're on the UI thread. | 586 // Just fetch the value from ChromeOS' settings while we're on the UI thread. |
| 567 // TODO(stevet): For now, this value is only set on profile initialization. | 587 // TODO(stevet): For now, this value is only set on profile initialization. |
| 568 // We will want to do something similar to the PrefMember method below in the | 588 // We will want to do something similar to the PrefMember method below in the |
| 569 // future to more accurately capture this state. | 589 // future to more accurately capture this state. |
| 570 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 590 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 571 &enable_metrics_); | 591 &enable_metrics_); |
| 572 #else | 592 #else |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 #endif | 733 #endif |
| 714 | 734 |
| 715 #if defined(OS_CHROMEOS) | 735 #if defined(OS_CHROMEOS) |
| 716 cert_verifier_.reset(new policy::PolicyCertVerifier( | 736 cert_verifier_.reset(new policy::PolicyCertVerifier( |
| 717 profile_params_->profile, profile_params_->trust_anchor_provider)); | 737 profile_params_->profile, profile_params_->trust_anchor_provider)); |
| 718 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 738 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
| 719 #else | 739 #else |
| 720 main_request_context_->set_cert_verifier( | 740 main_request_context_->set_cert_verifier( |
| 721 io_thread_globals->cert_verifier.get()); | 741 io_thread_globals->cert_verifier.get()); |
| 722 #endif | 742 #endif |
| 743 #if defined(USE_NSS) |
| 744 public_slot_ = profile_params_->public_slot.Pass(); |
| 745 private_slot_ = profile_params_->private_slot.Pass(); |
| 746 #endif |
| 723 | 747 |
| 724 InitializeInternal(profile_params_.get(), protocol_handlers); | 748 InitializeInternal(profile_params_.get(), protocol_handlers); |
| 725 | 749 |
| 726 profile_params_.reset(); | 750 profile_params_.reset(); |
| 727 initialized_ = true; | 751 initialized_ = true; |
| 728 } | 752 } |
| 729 | 753 |
| 730 void ProfileIOData::ApplyProfileParamsToContext( | 754 void ProfileIOData::ApplyProfileParamsToContext( |
| 731 ChromeURLRequestContext* context) const { | 755 ChromeURLRequestContext* context) const { |
| 732 context->set_http_user_agent_settings( | 756 context->set_http_user_agent_settings( |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 void ProfileIOData::SetCookieSettingsForTesting( | 886 void ProfileIOData::SetCookieSettingsForTesting( |
| 863 CookieSettings* cookie_settings) { | 887 CookieSettings* cookie_settings) { |
| 864 DCHECK(!cookie_settings_.get()); | 888 DCHECK(!cookie_settings_.get()); |
| 865 cookie_settings_ = cookie_settings; | 889 cookie_settings_ = cookie_settings; |
| 866 } | 890 } |
| 867 | 891 |
| 868 void ProfileIOData::set_signin_names_for_testing( | 892 void ProfileIOData::set_signin_names_for_testing( |
| 869 SigninNamesOnIOThread* signin_names) { | 893 SigninNamesOnIOThread* signin_names) { |
| 870 signin_names_.reset(signin_names); | 894 signin_names_.reset(signin_names); |
| 871 } | 895 } |
| OLD | NEW |