| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 383 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 384 &enable_referrers_, | 384 &enable_referrers_, |
| 385 &enable_do_not_track_, | 385 &enable_do_not_track_, |
| 386 &force_safesearch_, | 386 &force_safesearch_, |
| 387 pref_service); | 387 pref_service); |
| 388 | 388 |
| 389 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = | 389 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = |
| 390 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 390 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 391 #if defined(ENABLE_PRINTING) | 391 #if defined(ENABLE_PRINTING) |
| 392 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service); | 392 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service); |
| 393 printing_enabled_.MoveToThread(io_message_loop_proxy); | 393 printing_enabled_.MoveToTaskRunner(io_message_loop_proxy); |
| 394 #endif | 394 #endif |
| 395 | 395 |
| 396 chrome_http_user_agent_settings_.reset( | 396 chrome_http_user_agent_settings_.reset( |
| 397 new ChromeHttpUserAgentSettings(pref_service)); | 397 new ChromeHttpUserAgentSettings(pref_service)); |
| 398 | 398 |
| 399 // These members are used only for one click sign in, which is not enabled | 399 // These members are used only for one click sign in, which is not enabled |
| 400 // in incognito mode. So no need to initialize them. | 400 // in incognito mode. So no need to initialize them. |
| 401 if (!IsOffTheRecord()) { | 401 if (!IsOffTheRecord()) { |
| 402 signin_names_.reset(new SigninNamesOnIOThread()); | 402 signin_names_.reset(new SigninNamesOnIOThread()); |
| 403 | 403 |
| 404 google_services_user_account_id_.Init( | 404 google_services_user_account_id_.Init( |
| 405 prefs::kGoogleServicesUserAccountId, pref_service); | 405 prefs::kGoogleServicesUserAccountId, pref_service); |
| 406 google_services_user_account_id_.MoveToThread(io_message_loop_proxy); | 406 google_services_user_account_id_.MoveToTaskRunner(io_message_loop_proxy); |
| 407 | 407 |
| 408 google_services_username_.Init( | 408 google_services_username_.Init( |
| 409 prefs::kGoogleServicesUsername, pref_service); | 409 prefs::kGoogleServicesUsername, pref_service); |
| 410 google_services_username_.MoveToThread(io_message_loop_proxy); | 410 google_services_username_.MoveToTaskRunner(io_message_loop_proxy); |
| 411 | 411 |
| 412 google_services_username_pattern_.Init( | 412 google_services_username_pattern_.Init( |
| 413 prefs::kGoogleServicesUsernamePattern, local_state_pref_service); | 413 prefs::kGoogleServicesUsernamePattern, local_state_pref_service); |
| 414 google_services_username_pattern_.MoveToThread(io_message_loop_proxy); | 414 google_services_username_pattern_.MoveToTaskRunner(io_message_loop_proxy); |
| 415 | 415 |
| 416 reverse_autologin_enabled_.Init( | 416 reverse_autologin_enabled_.Init( |
| 417 prefs::kReverseAutologinEnabled, pref_service); | 417 prefs::kReverseAutologinEnabled, pref_service); |
| 418 reverse_autologin_enabled_.MoveToThread(io_message_loop_proxy); | 418 reverse_autologin_enabled_.MoveToTaskRunner(io_message_loop_proxy); |
| 419 | 419 |
| 420 one_click_signin_rejected_email_list_.Init( | 420 one_click_signin_rejected_email_list_.Init( |
| 421 prefs::kReverseAutologinRejectedEmailList, pref_service); | 421 prefs::kReverseAutologinRejectedEmailList, pref_service); |
| 422 one_click_signin_rejected_email_list_.MoveToThread(io_message_loop_proxy); | 422 one_click_signin_rejected_email_list_.MoveToTaskRunner( |
| 423 io_message_loop_proxy); |
| 423 | 424 |
| 424 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); | 425 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); |
| 425 sync_disabled_.MoveToThread(io_message_loop_proxy); | 426 sync_disabled_.MoveToTaskRunner(io_message_loop_proxy); |
| 426 | 427 |
| 427 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 428 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
| 428 signin_allowed_.MoveToThread(io_message_loop_proxy); | 429 signin_allowed_.MoveToTaskRunner(io_message_loop_proxy); |
| 429 } | 430 } |
| 430 | 431 |
| 431 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, | 432 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, |
| 432 local_state_pref_service); | 433 local_state_pref_service); |
| 433 quick_check_enabled_.MoveToThread(io_message_loop_proxy); | 434 quick_check_enabled_.MoveToTaskRunner(io_message_loop_proxy); |
| 434 | 435 |
| 435 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); | 436 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); |
| 436 | 437 |
| 437 // TODO(bnc): remove per https://crbug.com/334602. | 438 // TODO(bnc): remove per https://crbug.com/334602. |
| 438 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, | 439 network_prediction_enabled_.Init(prefs::kNetworkPredictionEnabled, |
| 439 pref_service); | 440 pref_service); |
| 440 network_prediction_enabled_.MoveToThread(io_message_loop_proxy); | 441 network_prediction_enabled_.MoveToTaskRunner(io_message_loop_proxy); |
| 441 | 442 |
| 442 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 443 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
| 443 pref_service); | 444 pref_service); |
| 444 | 445 |
| 445 network_prediction_options_.MoveToThread(io_message_loop_proxy); | 446 network_prediction_options_.MoveToTaskRunner(io_message_loop_proxy); |
| 446 | 447 |
| 447 #if defined(OS_CHROMEOS) | 448 #if defined(OS_CHROMEOS) |
| 448 cert_verifier_ = policy::PolicyCertServiceFactory::CreateForProfile(profile); | 449 cert_verifier_ = policy::PolicyCertServiceFactory::CreateForProfile(profile); |
| 449 #endif | 450 #endif |
| 450 // The URLBlacklistManager has to be created on the UI thread to register | 451 // The URLBlacklistManager has to be created on the UI thread to register |
| 451 // observers of |pref_service|, and it also has to clean up on | 452 // observers of |pref_service|, and it also has to clean up on |
| 452 // ShutdownOnUIThread to release these observers on the right thread. | 453 // ShutdownOnUIThread to release these observers on the right thread. |
| 453 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 454 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
| 454 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 455 // in particular when this ProfileIOData isn't |initialized_| during deletion. |
| 455 #if defined(ENABLE_CONFIGURATION_POLICY) | 456 #if defined(ENABLE_CONFIGURATION_POLICY) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 473 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 474 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
| 474 if (policy_header_service) { | 475 if (policy_header_service) { |
| 475 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( | 476 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( |
| 476 io_message_loop_proxy); | 477 io_message_loop_proxy); |
| 477 } | 478 } |
| 478 } | 479 } |
| 479 #endif | 480 #endif |
| 480 | 481 |
| 481 incognito_availibility_pref_.Init( | 482 incognito_availibility_pref_.Init( |
| 482 prefs::kIncognitoModeAvailability, pref_service); | 483 prefs::kIncognitoModeAvailability, pref_service); |
| 483 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 484 incognito_availibility_pref_.MoveToTaskRunner(io_message_loop_proxy); |
| 484 | 485 |
| 485 initialized_on_UI_thread_ = true; | 486 initialized_on_UI_thread_ = true; |
| 486 | 487 |
| 487 #if defined(OS_ANDROID) | 488 #if defined(OS_ANDROID) |
| 488 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 489 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 489 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 490 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 490 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, | 491 base::Bind(&ProfileIOData::SetDataReductionProxyUsageStatsOnIOThread, |
| 491 base::Unretained(this), g_browser_process->io_thread(), profile)); | 492 base::Unretained(this), g_browser_process->io_thread(), profile)); |
| 492 #endif | 493 #endif |
| 493 #endif | 494 #endif |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 // We will want to do something similar to the PrefMember method below in the | 810 // We will want to do something similar to the PrefMember method below in the |
| 810 // future to more accurately capture this state. | 811 // future to more accurately capture this state. |
| 811 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 812 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 812 &enable_metrics_); | 813 &enable_metrics_); |
| 813 #elif defined(OS_ANDROID) | 814 #elif defined(OS_ANDROID) |
| 814 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion | 815 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion |
| 815 // in crbugs.com/246495. | 816 // in crbugs.com/246495. |
| 816 // Android has it's own preferences for metrics / crash uploading. | 817 // Android has it's own preferences for metrics / crash uploading. |
| 817 enable_metrics_.Init(prefs::kCrashReportingEnabled, | 818 enable_metrics_.Init(prefs::kCrashReportingEnabled, |
| 818 g_browser_process->local_state()); | 819 g_browser_process->local_state()); |
| 819 enable_metrics_.MoveToThread( | 820 enable_metrics_.MoveToTaskRunner( |
| 820 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 821 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 821 #else | 822 #else |
| 822 // Prep the PrefMember and send it to the IO thread, since this value will be | 823 // Prep the PrefMember and send it to the IO thread, since this value will be |
| 823 // read from there. | 824 // read from there. |
| 824 enable_metrics_.Init(prefs::kMetricsReportingEnabled, | 825 enable_metrics_.Init(prefs::kMetricsReportingEnabled, |
| 825 g_browser_process->local_state()); | 826 g_browser_process->local_state()); |
| 826 enable_metrics_.MoveToThread( | 827 enable_metrics_.MoveToTaskRunner( |
| 827 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 828 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 828 #endif // defined(OS_CHROMEOS) | 829 #endif // defined(OS_CHROMEOS) |
| 829 } | 830 } |
| 830 | 831 |
| 831 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { | 832 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { |
| 832 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 833 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 833 #if defined(OS_CHROMEOS) | 834 #if defined(OS_CHROMEOS) |
| 834 return enable_metrics_; | 835 return enable_metrics_; |
| 835 #else | 836 #else |
| 836 return enable_metrics_.GetValue(); | 837 return enable_metrics_.GetValue(); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 void ProfileIOData::SetCookieSettingsForTesting( | 1249 void ProfileIOData::SetCookieSettingsForTesting( |
| 1249 CookieSettings* cookie_settings) { | 1250 CookieSettings* cookie_settings) { |
| 1250 DCHECK(!cookie_settings_.get()); | 1251 DCHECK(!cookie_settings_.get()); |
| 1251 cookie_settings_ = cookie_settings; | 1252 cookie_settings_ = cookie_settings; |
| 1252 } | 1253 } |
| 1253 | 1254 |
| 1254 void ProfileIOData::set_signin_names_for_testing( | 1255 void ProfileIOData::set_signin_names_for_testing( |
| 1255 SigninNamesOnIOThread* signin_names) { | 1256 SigninNamesOnIOThread* signin_names) { |
| 1256 signin_names_.reset(signin_names); | 1257 signin_names_.reset(signin_names); |
| 1257 } | 1258 } |
| OLD | NEW |