| 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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 429 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 430 &enable_referrers_, | 430 &enable_referrers_, |
| 431 &enable_do_not_track_, | 431 &enable_do_not_track_, |
| 432 &force_safesearch_, | 432 &force_safesearch_, |
| 433 pref_service); | 433 pref_service); |
| 434 | 434 |
| 435 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = | 435 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = |
| 436 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 436 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 437 #if defined(ENABLE_PRINTING) | 437 #if defined(ENABLE_PRINTING) |
| 438 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service); | 438 printing_enabled_.Init(prefs::kPrintingEnabled, pref_service); |
| 439 printing_enabled_.MoveToThread(io_message_loop_proxy); | 439 printing_enabled_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 440 #endif | 440 #endif |
| 441 | 441 |
| 442 chrome_http_user_agent_settings_.reset( | 442 chrome_http_user_agent_settings_.reset( |
| 443 new ChromeHttpUserAgentSettings(pref_service)); | 443 new ChromeHttpUserAgentSettings(pref_service)); |
| 444 | 444 |
| 445 // These members are used only for one click sign in, which is not enabled | 445 // These members are used only for one click sign in, which is not enabled |
| 446 // in incognito mode. So no need to initialize them. | 446 // in incognito mode. So no need to initialize them. |
| 447 if (!IsOffTheRecord()) { | 447 if (!IsOffTheRecord()) { |
| 448 signin_names_.reset(new SigninNamesOnIOThread()); | 448 signin_names_.reset(new SigninNamesOnIOThread()); |
| 449 | 449 |
| 450 google_services_user_account_id_.Init( | 450 google_services_user_account_id_.Init( |
| 451 prefs::kGoogleServicesUserAccountId, pref_service); | 451 prefs::kGoogleServicesUserAccountId, pref_service); |
| 452 google_services_user_account_id_.MoveToThread(io_message_loop_proxy); | 452 google_services_user_account_id_.UseAlternateTaskRunner( |
| 453 io_message_loop_proxy); |
| 453 | 454 |
| 454 google_services_username_.Init( | 455 google_services_username_.Init( |
| 455 prefs::kGoogleServicesUsername, pref_service); | 456 prefs::kGoogleServicesUsername, pref_service); |
| 456 google_services_username_.MoveToThread(io_message_loop_proxy); | 457 google_services_username_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 457 | 458 |
| 458 google_services_username_pattern_.Init( | 459 google_services_username_pattern_.Init( |
| 459 prefs::kGoogleServicesUsernamePattern, local_state_pref_service); | 460 prefs::kGoogleServicesUsernamePattern, local_state_pref_service); |
| 460 google_services_username_pattern_.MoveToThread(io_message_loop_proxy); | 461 google_services_username_pattern_.UseAlternateTaskRunner( |
| 462 io_message_loop_proxy); |
| 461 | 463 |
| 462 reverse_autologin_enabled_.Init( | 464 reverse_autologin_enabled_.Init( |
| 463 prefs::kReverseAutologinEnabled, pref_service); | 465 prefs::kReverseAutologinEnabled, pref_service); |
| 464 reverse_autologin_enabled_.MoveToThread(io_message_loop_proxy); | 466 reverse_autologin_enabled_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 465 | 467 |
| 466 one_click_signin_rejected_email_list_.Init( | 468 one_click_signin_rejected_email_list_.Init( |
| 467 prefs::kReverseAutologinRejectedEmailList, pref_service); | 469 prefs::kReverseAutologinRejectedEmailList, pref_service); |
| 468 one_click_signin_rejected_email_list_.MoveToThread(io_message_loop_proxy); | 470 one_click_signin_rejected_email_list_.UseAlternateTaskRunner( |
| 471 io_message_loop_proxy); |
| 469 | 472 |
| 470 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); | 473 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); |
| 471 sync_disabled_.MoveToThread(io_message_loop_proxy); | 474 sync_disabled_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 472 | 475 |
| 473 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 476 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
| 474 signin_allowed_.MoveToThread(io_message_loop_proxy); | 477 signin_allowed_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 475 } | 478 } |
| 476 | 479 |
| 477 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, | 480 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, |
| 478 local_state_pref_service); | 481 local_state_pref_service); |
| 479 quick_check_enabled_.MoveToThread(io_message_loop_proxy); | 482 quick_check_enabled_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 480 | 483 |
| 481 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); | 484 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); |
| 482 | 485 |
| 483 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 486 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
| 484 pref_service); | 487 pref_service); |
| 485 | 488 |
| 486 network_prediction_options_.MoveToThread(io_message_loop_proxy); | 489 network_prediction_options_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 487 | 490 |
| 488 #if defined(OS_CHROMEOS) | 491 #if defined(OS_CHROMEOS) |
| 489 scoped_ptr<policy::PolicyCertVerifier> verifier = | 492 scoped_ptr<policy::PolicyCertVerifier> verifier = |
| 490 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 493 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
| 491 policy_cert_verifier_ = verifier.get(); | 494 policy_cert_verifier_ = verifier.get(); |
| 492 cert_verifier_ = verifier.Pass(); | 495 cert_verifier_ = verifier.Pass(); |
| 493 #endif | 496 #endif |
| 494 // The URLBlacklistManager has to be created on the UI thread to register | 497 // The URLBlacklistManager has to be created on the UI thread to register |
| 495 // observers of |pref_service|, and it also has to clean up on | 498 // observers of |pref_service|, and it also has to clean up on |
| 496 // ShutdownOnUIThread to release these observers on the right thread. | 499 // ShutdownOnUIThread to release these observers on the right thread. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 517 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 520 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
| 518 if (policy_header_service) { | 521 if (policy_header_service) { |
| 519 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( | 522 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( |
| 520 io_message_loop_proxy); | 523 io_message_loop_proxy); |
| 521 } | 524 } |
| 522 } | 525 } |
| 523 #endif | 526 #endif |
| 524 | 527 |
| 525 incognito_availibility_pref_.Init( | 528 incognito_availibility_pref_.Init( |
| 526 prefs::kIncognitoModeAvailability, pref_service); | 529 prefs::kIncognitoModeAvailability, pref_service); |
| 527 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 530 incognito_availibility_pref_.UseAlternateTaskRunner(io_message_loop_proxy); |
| 528 | 531 |
| 529 initialized_on_UI_thread_ = true; | 532 initialized_on_UI_thread_ = true; |
| 530 | 533 |
| 531 // We need to make sure that content initializes its own data structures that | 534 // We need to make sure that content initializes its own data structures that |
| 532 // are associated with each ResourceContext because we might post this | 535 // are associated with each ResourceContext because we might post this |
| 533 // object to the IO thread after this function. | 536 // object to the IO thread after this function. |
| 534 BrowserContext::EnsureResourceContextInitialized(profile); | 537 BrowserContext::EnsureResourceContextInitialized(profile); |
| 535 } | 538 } |
| 536 | 539 |
| 537 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 540 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 // We will want to do something similar to the PrefMember method below in the | 838 // We will want to do something similar to the PrefMember method below in the |
| 836 // future to more accurately capture this state. | 839 // future to more accurately capture this state. |
| 837 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 840 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 838 &enable_metrics_); | 841 &enable_metrics_); |
| 839 #elif defined(OS_ANDROID) | 842 #elif defined(OS_ANDROID) |
| 840 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion | 843 // TODO(dwkang): rename or unify the pref for UMA once we have conclusion |
| 841 // in crbugs.com/246495. | 844 // in crbugs.com/246495. |
| 842 // Android has it's own preferences for metrics / crash uploading. | 845 // Android has it's own preferences for metrics / crash uploading. |
| 843 enable_metrics_.Init(prefs::kCrashReportingEnabled, | 846 enable_metrics_.Init(prefs::kCrashReportingEnabled, |
| 844 g_browser_process->local_state()); | 847 g_browser_process->local_state()); |
| 845 enable_metrics_.MoveToThread( | 848 enable_metrics_.UseAlternateTaskRunner( |
| 846 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 849 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 847 #else | 850 #else |
| 848 // Prep the PrefMember and send it to the IO thread, since this value will be | 851 // Prep the PrefMember and send it to the IO thread, since this value will be |
| 849 // read from there. | 852 // read from there. |
| 850 enable_metrics_.Init(prefs::kMetricsReportingEnabled, | 853 enable_metrics_.Init(prefs::kMetricsReportingEnabled, |
| 851 g_browser_process->local_state()); | 854 g_browser_process->local_state()); |
| 852 enable_metrics_.MoveToThread( | 855 enable_metrics_.UseAlternateTaskRunner( |
| 853 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 856 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 854 #endif // defined(OS_CHROMEOS) | 857 #endif // defined(OS_CHROMEOS) |
| 855 } | 858 } |
| 856 | 859 |
| 857 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { | 860 bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { |
| 858 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 861 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 859 #if defined(OS_CHROMEOS) | 862 #if defined(OS_CHROMEOS) |
| 860 return enable_metrics_; | 863 return enable_metrics_; |
| 861 #else | 864 #else |
| 862 return enable_metrics_.GetValue(); | 865 return enable_metrics_.GetValue(); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 void ProfileIOData::SetCookieSettingsForTesting( | 1281 void ProfileIOData::SetCookieSettingsForTesting( |
| 1279 CookieSettings* cookie_settings) { | 1282 CookieSettings* cookie_settings) { |
| 1280 DCHECK(!cookie_settings_.get()); | 1283 DCHECK(!cookie_settings_.get()); |
| 1281 cookie_settings_ = cookie_settings; | 1284 cookie_settings_ = cookie_settings; |
| 1282 } | 1285 } |
| 1283 | 1286 |
| 1284 void ProfileIOData::set_signin_names_for_testing( | 1287 void ProfileIOData::set_signin_names_for_testing( |
| 1285 SigninNamesOnIOThread* signin_names) { | 1288 SigninNamesOnIOThread* signin_names) { |
| 1286 signin_names_.reset(signin_names); | 1289 signin_names_.reset(signin_names); |
| 1287 } | 1290 } |
| OLD | NEW |