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/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 #include "crypto/nss_util_internal.h" | 111 #include "crypto/nss_util_internal.h" |
| 112 #include "net/cert/multi_threaded_cert_verifier.h" | 112 #include "net/cert/multi_threaded_cert_verifier.h" |
| 113 #include "net/ssl/client_cert_store_chromeos.h" | 113 #include "net/ssl/client_cert_store_chromeos.h" |
| 114 #endif // defined(OS_CHROMEOS) | 114 #endif // defined(OS_CHROMEOS) |
| 115 | 115 |
| 116 #if defined(USE_NSS) | 116 #if defined(USE_NSS) |
| 117 #include "chrome/browser/ui/crypto_module_delegate_nss.h" | 117 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
| 118 #include "net/ssl/client_cert_store_nss.h" | 118 #include "net/ssl/client_cert_store_nss.h" |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 #if defined(OS_ANDROID) | |
| 122 #include "chrome/browser/android/chromium_application.h" | |
| 123 #endif // OS_ANDROID | |
| 124 | |
| 121 #if defined(OS_WIN) | 125 #if defined(OS_WIN) |
| 126 #include "base/win/metro.h" | |
| 122 #include "net/ssl/client_cert_store_win.h" | 127 #include "net/ssl/client_cert_store_win.h" |
| 123 #endif | 128 #endif |
| 124 | 129 |
| 125 #if defined(OS_MACOSX) | 130 #if defined(OS_MACOSX) |
| 126 #include "net/ssl/client_cert_store_mac.h" | 131 #include "net/ssl/client_cert_store_mac.h" |
| 127 #endif | 132 #endif |
| 128 | 133 |
| 129 using content::BrowserContext; | 134 using content::BrowserContext; |
| 130 using content::BrowserThread; | 135 using content::BrowserThread; |
| 131 using content::ResourceContext; | 136 using content::ResourceContext; |
| 132 | 137 |
| 133 namespace { | 138 namespace { |
| 134 | 139 |
| 140 #if defined(OS_WIN) | |
| 141 bool g_parental_control_on = false; | |
|
mmenke
2014/06/17 20:41:44
Why not make this a member of ProfileIOData?
mmenke
2014/06/17 20:44:13
Alternatively, put it in some other file (metro.h?
guohui
2014/06/18 19:36:38
Done.
| |
| 142 #endif // OS_WIN | |
| 143 | |
| 135 #if defined(DEBUG_DEVTOOLS) | 144 #if defined(DEBUG_DEVTOOLS) |
| 136 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { | 145 bool IsSupportedDevToolsURL(const GURL& url, base::FilePath* path) { |
| 137 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); | 146 std::string bundled_path_prefix(chrome::kChromeUIDevToolsBundledPath); |
| 138 bundled_path_prefix = "/" + bundled_path_prefix + "/"; | 147 bundled_path_prefix = "/" + bundled_path_prefix + "/"; |
| 139 | 148 |
| 140 if (!url.SchemeIs(content::kChromeDevToolsScheme) || | 149 if (!url.SchemeIs(content::kChromeDevToolsScheme) || |
| 141 url.host() != chrome::kChromeUIDevToolsHost || | 150 url.host() != chrome::kChromeUIDevToolsHost || |
| 142 !StartsWithASCII(url.path(), bundled_path_prefix, false)) { | 151 !StartsWithASCII(url.path(), bundled_path_prefix, false)) { |
| 143 return false; | 152 return false; |
| 144 } | 153 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 // Add policy headers for non-incognito requests. | 466 // Add policy headers for non-incognito requests. |
| 458 policy::PolicyHeaderService* policy_header_service = | 467 policy::PolicyHeaderService* policy_header_service = |
| 459 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 468 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
| 460 if (policy_header_service) { | 469 if (policy_header_service) { |
| 461 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( | 470 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( |
| 462 io_message_loop_proxy); | 471 io_message_loop_proxy); |
| 463 } | 472 } |
| 464 } | 473 } |
| 465 #endif | 474 #endif |
| 466 | 475 |
| 476 #if defined(OS_WIN) | |
| 477 g_parental_control_on = base::win::IsParentalControlActivityLoggingOn(); | |
| 478 #endif // OS_WIN | |
| 479 | |
| 467 incognito_availibility_pref_.Init( | 480 incognito_availibility_pref_.Init( |
| 468 prefs::kIncognitoModeAvailability, pref_service); | 481 prefs::kIncognitoModeAvailability, pref_service); |
| 469 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 482 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
| 470 | 483 |
| 471 initialized_on_UI_thread_ = true; | 484 initialized_on_UI_thread_ = true; |
| 472 | 485 |
| 473 // We need to make sure that content initializes its own data structures that | 486 // We need to make sure that content initializes its own data structures that |
| 474 // are associated with each ResourceContext because we might post this | 487 // are associated with each ResourceContext because we might post this |
| 475 // object to the IO thread after this function. | 488 // object to the IO thread after this function. |
| 476 BrowserContext::EnsureResourceContextInitialized(profile); | 489 BrowserContext::EnsureResourceContextInitialized(profile); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 | 758 |
| 746 ResourceContext::SaltCallback ProfileIOData::GetMediaDeviceIDSalt() const { | 759 ResourceContext::SaltCallback ProfileIOData::GetMediaDeviceIDSalt() const { |
| 747 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); | 760 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); |
| 748 } | 761 } |
| 749 | 762 |
| 750 bool ProfileIOData::IsOffTheRecord() const { | 763 bool ProfileIOData::IsOffTheRecord() const { |
| 751 return profile_type() == Profile::INCOGNITO_PROFILE | 764 return profile_type() == Profile::INCOGNITO_PROFILE |
| 752 || profile_type() == Profile::GUEST_PROFILE; | 765 || profile_type() == Profile::GUEST_PROFILE; |
| 753 } | 766 } |
| 754 | 767 |
| 768 bool ProfileIOData::ArePlatformParentalControlsEnabledCached() const { | |
| 769 #if defined(OS_WIN) | |
| 770 return g_parental_control_on; | |
| 771 #elif defined(OS_ANDROID) | |
| 772 return chrome::android::ChromiumApplication::AreParentalControlsEnabled(); | |
| 773 #else | |
| 774 return false; | |
| 775 #endif | |
| 776 } | |
| 777 | |
| 755 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { | 778 void ProfileIOData::InitializeMetricsEnabledStateOnUIThread() { |
| 756 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 779 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 757 #if defined(OS_CHROMEOS) | 780 #if defined(OS_CHROMEOS) |
| 758 // Just fetch the value from ChromeOS' settings while we're on the UI thread. | 781 // Just fetch the value from ChromeOS' settings while we're on the UI thread. |
| 759 // TODO(stevet): For now, this value is only set on profile initialization. | 782 // TODO(stevet): For now, this value is only set on profile initialization. |
| 760 // We will want to do something similar to the PrefMember method below in the | 783 // We will want to do something similar to the PrefMember method below in the |
| 761 // future to more accurately capture this state. | 784 // future to more accurately capture this state. |
| 762 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 785 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 763 &enable_metrics_); | 786 &enable_metrics_); |
| 764 #elif defined(OS_ANDROID) | 787 #elif defined(OS_ANDROID) |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1191 void ProfileIOData::SetCookieSettingsForTesting( | 1214 void ProfileIOData::SetCookieSettingsForTesting( |
| 1192 CookieSettings* cookie_settings) { | 1215 CookieSettings* cookie_settings) { |
| 1193 DCHECK(!cookie_settings_.get()); | 1216 DCHECK(!cookie_settings_.get()); |
| 1194 cookie_settings_ = cookie_settings; | 1217 cookie_settings_ = cookie_settings; |
| 1195 } | 1218 } |
| 1196 | 1219 |
| 1197 void ProfileIOData::set_signin_names_for_testing( | 1220 void ProfileIOData::set_signin_names_for_testing( |
| 1198 SigninNamesOnIOThread* signin_names) { | 1221 SigninNamesOnIOThread* signin_names) { |
| 1199 signin_names_.reset(signin_names); | 1222 signin_names_.reset(signin_names); |
| 1200 } | 1223 } |
| OLD | NEW |