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::SingleThreadTaskRunner> io_task_runner = | 459 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy = |
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_task_runner); | 470 google_services_user_account_id_.MoveToThread(io_message_loop_proxy); |
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_task_runner); | 473 sync_disabled_.MoveToThread(io_message_loop_proxy); |
474 | 474 |
475 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 475 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
476 signin_allowed_.MoveToThread(io_task_runner); | 476 signin_allowed_.MoveToThread(io_message_loop_proxy); |
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_task_runner); | 481 quick_check_enabled_.MoveToThread(io_message_loop_proxy); |
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_task_runner); | 488 network_prediction_options_.MoveToThread(io_message_loop_proxy); |
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(new policy::URLBlacklistManager( | 508 url_blacklist_manager_.reset( |
509 pref_service, background_task_runner, io_task_runner, callback, | 509 new policy::URLBlacklistManager( |
510 base::Bind(policy::OverrideBlacklistForURL))); | 510 pref_service, |
| 511 background_task_runner, |
| 512 io_message_loop_proxy, |
| 513 callback, |
| 514 base::Bind(policy::OverrideBlacklistForURL))); |
511 | 515 |
512 if (!IsOffTheRecord()) { | 516 if (!IsOffTheRecord()) { |
513 // Add policy headers for non-incognito requests. | 517 // Add policy headers for non-incognito requests. |
514 policy::PolicyHeaderService* policy_header_service = | 518 policy::PolicyHeaderService* policy_header_service = |
515 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 519 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
516 if (policy_header_service) { | 520 if (policy_header_service) { |
517 policy_header_helper_ = | 521 policy_header_helper_ = policy_header_service->CreatePolicyHeaderIOHelper( |
518 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); | 522 io_message_loop_proxy); |
519 } | 523 } |
520 } | 524 } |
521 #endif | 525 #endif |
522 | 526 |
523 incognito_availibility_pref_.Init( | 527 incognito_availibility_pref_.Init( |
524 prefs::kIncognitoModeAvailability, pref_service); | 528 prefs::kIncognitoModeAvailability, pref_service); |
525 incognito_availibility_pref_.MoveToThread(io_task_runner); | 529 incognito_availibility_pref_.MoveToThread(io_message_loop_proxy); |
526 | 530 |
527 initialized_on_UI_thread_ = true; | 531 initialized_on_UI_thread_ = true; |
528 | 532 |
529 // We need to make sure that content initializes its own data structures that | 533 // We need to make sure that content initializes its own data structures that |
530 // are associated with each ResourceContext because we might post this | 534 // are associated with each ResourceContext because we might post this |
531 // object to the IO thread after this function. | 535 // object to the IO thread after this function. |
532 BrowserContext::EnsureResourceContextInitialized(profile); | 536 BrowserContext::EnsureResourceContextInitialized(profile); |
533 } | 537 } |
534 | 538 |
535 ProfileIOData::MediaRequestContext::MediaRequestContext() { | 539 ProfileIOData::MediaRequestContext::MediaRequestContext() { |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 new DevToolsNetworkTransactionFactory( | 1287 new DevToolsNetworkTransactionFactory( |
1284 network_controller_.get(), shared_session), | 1288 network_controller_.get(), shared_session), |
1285 shared_session->net_log(), backend)); | 1289 shared_session->net_log(), backend)); |
1286 } | 1290 } |
1287 | 1291 |
1288 void ProfileIOData::SetCookieSettingsForTesting( | 1292 void ProfileIOData::SetCookieSettingsForTesting( |
1289 CookieSettings* cookie_settings) { | 1293 CookieSettings* cookie_settings) { |
1290 DCHECK(!cookie_settings_.get()); | 1294 DCHECK(!cookie_settings_.get()); |
1291 cookie_settings_ = cookie_settings; | 1295 cookie_settings_ = cookie_settings; |
1292 } | 1296 } |
OLD | NEW |