| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 params->profile = profile; | 187 params->profile = profile; |
| 188 profile_params_.reset(params.release()); | 188 profile_params_.reset(params.release()); |
| 189 | 189 |
| 190 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 190 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 191 &enable_referrers_, | 191 &enable_referrers_, |
| 192 &enable_do_not_track_, | 192 &enable_do_not_track_, |
| 193 &force_safesearch_, | 193 &force_safesearch_, |
| 194 pref_service); | 194 pref_service); |
| 195 | 195 |
| 196 #if defined(ENABLE_PRINTING) | 196 #if defined(ENABLE_PRINTING) |
| 197 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service, NULL); | 197 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service); |
| 198 printing_enabled_.MoveToThread( | 198 printing_enabled_.MoveToThread( |
| 199 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 199 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 200 #endif | 200 #endif |
| 201 chrome_http_user_agent_settings_.reset( | 201 chrome_http_user_agent_settings_.reset( |
| 202 new ChromeHttpUserAgentSettings(pref_service)); | 202 new ChromeHttpUserAgentSettings(pref_service)); |
| 203 | 203 |
| 204 // These members are used only for one click sign in, which is not enabled | 204 // These members are used only for one click sign in, which is not enabled |
| 205 // in incognito mode. So no need to initialize them. | 205 // in incognito mode. So no need to initialize them. |
| 206 if (!is_incognito()) { | 206 if (!is_incognito()) { |
| 207 signin_names_.reset(new SigninNamesOnIOThread()); | 207 signin_names_.reset(new SigninNamesOnIOThread()); |
| 208 | 208 |
| 209 google_services_username_.Init(prefs::kGoogleServicesUsername, pref_service, | 209 google_services_username_.Init(prefs::kGoogleServicesUsername, |
| 210 NULL); | 210 pref_service); |
| 211 google_services_username_.MoveToThread( | 211 google_services_username_.MoveToThread( |
| 212 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 212 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 213 | 213 |
| 214 google_services_username_pattern_.Init( | 214 google_services_username_pattern_.Init( |
| 215 prefs::kGoogleServicesUsernamePattern, local_state_pref_service, NULL); | 215 prefs::kGoogleServicesUsernamePattern, local_state_pref_service); |
| 216 google_services_username_pattern_.MoveToThread( | 216 google_services_username_pattern_.MoveToThread( |
| 217 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 217 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 218 | 218 |
| 219 reverse_autologin_enabled_.Init( | 219 reverse_autologin_enabled_.Init( |
| 220 prefs::kReverseAutologinEnabled, pref_service, NULL); | 220 prefs::kReverseAutologinEnabled, pref_service); |
| 221 reverse_autologin_enabled_.MoveToThread( | 221 reverse_autologin_enabled_.MoveToThread( |
| 222 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 222 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 223 | 223 |
| 224 one_click_signin_rejected_email_list_.Init( | 224 one_click_signin_rejected_email_list_.Init( |
| 225 prefs::kReverseAutologinRejectedEmailList, pref_service, NULL); | 225 prefs::kReverseAutologinRejectedEmailList, pref_service); |
| 226 one_click_signin_rejected_email_list_.MoveToThread( | 226 one_click_signin_rejected_email_list_.MoveToThread( |
| 227 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 227 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // The URLBlacklistManager has to be created on the UI thread to register | 230 // The URLBlacklistManager has to be created on the UI thread to register |
| 231 // observers of |pref_service|, and it also has to clean up on | 231 // observers of |pref_service|, and it also has to clean up on |
| 232 // ShutdownOnUIThread to release these observers on the right thread. | 232 // ShutdownOnUIThread to release these observers on the right thread. |
| 233 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 233 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
| 234 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 234 // in particular when this ProfileIOData isn't |initialized_| during deletion. |
| 235 #if defined(ENABLE_CONFIGURATION_POLICY) | 235 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Just fetch the value from ChromeOS' settings while we're on the UI thread. | 450 // Just fetch the value from ChromeOS' settings while we're on the UI thread. |
| 451 // TODO(stevet): For now, this value is only set on profile initialization. | 451 // TODO(stevet): For now, this value is only set on profile initialization. |
| 452 // We will want to do something similar to the PrefMember method below in the | 452 // We will want to do something similar to the PrefMember method below in the |
| 453 // future to more accurately capture this state. | 453 // future to more accurately capture this state. |
| 454 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 454 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 455 &enable_metrics_); | 455 &enable_metrics_); |
| 456 #else | 456 #else |
| 457 // Prep the PrefMember and send it to the IO thread, since this value will be | 457 // Prep the PrefMember and send it to the IO thread, since this value will be |
| 458 // read from there. | 458 // read from there. |
| 459 enable_metrics_.Init(prefs::kMetricsReportingEnabled, | 459 enable_metrics_.Init(prefs::kMetricsReportingEnabled, |
| 460 g_browser_process->local_state(), | 460 g_browser_process->local_state()); |
| 461 NULL); | |
| 462 enable_metrics_.MoveToThread( | 461 enable_metrics_.MoveToThread( |
| 463 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 462 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 464 #endif // defined(OS_CHROMEOS) | 463 #endif // defined(OS_CHROMEOS) |
| 465 } | 464 } |
| 466 | 465 |
| 467 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { | 466 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { |
| 468 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 467 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 469 #if defined(OS_CHROMEOS) | 468 #if defined(OS_CHROMEOS) |
| 470 return enable_metrics_; | 469 return enable_metrics_; |
| 471 #else | 470 #else |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 void ProfileIOData::SetCookieSettingsForTesting( | 748 void ProfileIOData::SetCookieSettingsForTesting( |
| 750 CookieSettings* cookie_settings) { | 749 CookieSettings* cookie_settings) { |
| 751 DCHECK(!cookie_settings_.get()); | 750 DCHECK(!cookie_settings_.get()); |
| 752 cookie_settings_ = cookie_settings; | 751 cookie_settings_ = cookie_settings; |
| 753 } | 752 } |
| 754 | 753 |
| 755 void ProfileIOData::set_signin_names_for_testing( | 754 void ProfileIOData::set_signin_names_for_testing( |
| 756 SigninNamesOnIOThread* signin_names) { | 755 SigninNamesOnIOThread* signin_names) { |
| 757 signin_names_.reset(signin_names); | 756 signin_names_.reset(signin_names); |
| 758 } | 757 } |
| OLD | NEW |