| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 params->profile = profile; | 449 params->profile = profile; |
| 450 profile_params_.reset(params.release()); | 450 profile_params_.reset(params.release()); |
| 451 | 451 |
| 452 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 452 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 453 &enable_referrers_, | 453 &enable_referrers_, |
| 454 &enable_do_not_track_, | 454 &enable_do_not_track_, |
| 455 &force_google_safesearch_, | 455 &force_google_safesearch_, |
| 456 &force_youtube_safety_mode_, | 456 &force_youtube_safety_mode_, |
| 457 pref_service); | 457 pref_service); |
| 458 | 458 |
| 459 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = | 459 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = |
| 460 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 460 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
| 461 | 461 |
| 462 chrome_http_user_agent_settings_.reset( | 462 chrome_http_user_agent_settings_.reset( |
| 463 new ChromeHttpUserAgentSettings(pref_service)); | 463 new ChromeHttpUserAgentSettings(pref_service)); |
| 464 | 464 |
| 465 // These members are used only for sign in, which is not enabled | 465 // These members are used only for sign in, which is not enabled |
| 466 // in incognito mode. So no need to initialize them. | 466 // in incognito mode. So no need to initialize them. |
| 467 if (!IsOffTheRecord()) { | 467 if (!IsOffTheRecord()) { |
| 468 google_services_user_account_id_.Init( | 468 google_services_user_account_id_.Init( |
| 469 prefs::kGoogleServicesUserAccountId, pref_service); | 469 prefs::kGoogleServicesUserAccountId, pref_service); |
| 470 google_services_user_account_id_.MoveToThread(io_message_loop_proxy); | 470 google_services_user_account_id_.MoveToThread(io_task_runner); |
| 471 | 471 |
| 472 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); | 472 sync_disabled_.Init(sync_driver::prefs::kSyncManaged, pref_service); |
| 473 sync_disabled_.MoveToThread(io_message_loop_proxy); | 473 sync_disabled_.MoveToThread(io_task_runner); |
| 474 | 474 |
| 475 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 475 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
| 476 signin_allowed_.MoveToThread(io_message_loop_proxy); | 476 signin_allowed_.MoveToThread(io_task_runner); |
| 477 } | 477 } |
| 478 | 478 |
| 479 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, | 479 quick_check_enabled_.Init(prefs::kQuickCheckEnabled, |
| 480 local_state_pref_service); | 480 local_state_pref_service); |
| 481 quick_check_enabled_.MoveToThread(io_message_loop_proxy); | 481 quick_check_enabled_.MoveToThread(io_task_runner); |
| 482 | 482 |
| 483 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); | 483 media_device_id_salt_ = new MediaDeviceIDSalt(pref_service, IsOffTheRecord()); |
| 484 | 484 |
| 485 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, | 485 network_prediction_options_.Init(prefs::kNetworkPredictionOptions, |
| 486 pref_service); | 486 pref_service); |
| 487 | 487 |
| 488 network_prediction_options_.MoveToThread(io_message_loop_proxy); | 488 network_prediction_options_.MoveToThread(io_task_runner); |
| 489 | 489 |
| 490 #if defined(OS_CHROMEOS) | 490 #if defined(OS_CHROMEOS) |
| 491 scoped_ptr<policy::PolicyCertVerifier> verifier = | 491 scoped_ptr<policy::PolicyCertVerifier> verifier = |
| 492 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 492 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
| 493 policy_cert_verifier_ = verifier.get(); | 493 policy_cert_verifier_ = verifier.get(); |
| 494 cert_verifier_ = verifier.Pass(); | 494 cert_verifier_ = verifier.Pass(); |
| 495 #endif | 495 #endif |
| 496 // The URLBlacklistManager has to be created on the UI thread to register | 496 // The URLBlacklistManager has to be created on the UI thread to register |
| 497 // observers of |pref_service|, and it also has to clean up on | 497 // observers of |pref_service|, and it also has to clean up on |
| 498 // ShutdownOnUIThread to release these observers on the right thread. | 498 // ShutdownOnUIThread to release these observers on the right thread. |
| 499 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 499 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
| 500 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 500 // in particular when this ProfileIOData isn't |initialized_| during deletion. |
| 501 #if defined(ENABLE_CONFIGURATION_POLICY) | 501 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 502 policy::URLBlacklist::SegmentURLCallback callback = | 502 policy::URLBlacklist::SegmentURLCallback callback = |
| 503 static_cast<policy::URLBlacklist::SegmentURLCallback>( | 503 static_cast<policy::URLBlacklist::SegmentURLCallback>( |
| 504 url_fixer::SegmentURL); | 504 url_fixer::SegmentURL); |
| 505 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 505 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
| 506 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 506 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
| 507 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 507 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
| 508 url_blacklist_manager_.reset( | 508 url_blacklist_manager_.reset(new policy::URLBlacklistManager( |
| 509 new policy::URLBlacklistManager( | 509 pref_service, background_task_runner, io_task_runner, callback, |
| 510 pref_service, | 510 base::Bind(policy::OverrideBlacklistForURL))); |
| 511 background_task_runner, | |
| 512 io_message_loop_proxy, | |
| 513 callback, | |
| 514 base::Bind(policy::OverrideBlacklistForURL))); | |
| 515 | 511 |
| 516 if (!IsOffTheRecord()) { | 512 if (!IsOffTheRecord()) { |
| 517 // Add policy headers for non-incognito requests. | 513 // Add policy headers for non-incognito requests. |
| 518 policy::PolicyHeaderService* policy_header_service = | 514 policy::PolicyHeaderService* policy_header_service = |
| 519 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 515 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
| 520 if (policy_header_service) { | 516 if (policy_header_service) { |
| 521 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( | 517 policy_header_helper_ = |
| 522 io_message_loop_proxy); | 518 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); |
| 523 } | 519 } |
| 524 } | 520 } |
| 525 #endif | 521 #endif |
| 526 | 522 |
| 527 incognito_availibility_pref_.Init( | 523 incognito_availibility_pref_.Init( |
| 528 prefs::kIncognitoModeAvailability, pref_service); | 524 prefs::kIncognitoModeAvailability, pref_service); |
| 529 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); | 525 incognito_availibility_pref_.MoveToThread(io_task_runner); |
| 530 | 526 |
| 531 initialized_on_UI_thread_ = true; | 527 initialized_on_UI_thread_ = true; |
| 532 | 528 |
| 533 // We need to make sure that content initializes its own data structures that | 529 // We need to make sure that content initializes its own data structures that |
| 534 // are associated with each ResourceContext because we might post this | 530 // are associated with each ResourceContext because we might post this |
| 535 // object to the IO thread after this function. | 531 // object to the IO thread after this function. |
| 536 BrowserContext::EnsureResourceContextInitialized(profile); | 532 BrowserContext::EnsureResourceContextInitialized(profile); |
| 537 } | 533 } |
| 538 | 534 |
| 539 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 535 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 new DevToolsNetworkTransactionFactory( | 1283 new DevToolsNetworkTransactionFactory( |
| 1288 network_controller_.get(), shared_session), | 1284 network_controller_.get(), shared_session), |
| 1289 shared_session->net_log(), backend)); | 1285 shared_session->net_log(), backend)); |
| 1290 } | 1286 } |
| 1291 | 1287 |
| 1292 void ProfileIOData::SetCookieSettingsForTesting( | 1288 void ProfileIOData::SetCookieSettingsForTesting( |
| 1293 CookieSettings* cookie_settings) { | 1289 CookieSettings* cookie_settings) { |
| 1294 DCHECK(!cookie_settings_.get()); | 1290 DCHECK(!cookie_settings_.get()); |
| 1295 cookie_settings_ = cookie_settings; | 1291 cookie_settings_ = cookie_settings; |
| 1296 } | 1292 } |
| OLD | NEW |