Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 #include "chrome/common/chrome_paths.h" | 51 #include "chrome/common/chrome_paths.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 54 #include "chrome/common/startup_metric_utils.h" | 54 #include "chrome/common/startup_metric_utils.h" |
| 55 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 56 #include "content/public/browser/browser_thread.h" | 56 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/host_zoom_map.h" | 57 #include "content/public/browser/host_zoom_map.h" |
| 58 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
| 59 #include "content/public/browser/resource_context.h" | 59 #include "content/public/browser/resource_context.h" |
| 60 #include "extensions/common/constants.h" | 60 #include "extensions/common/constants.h" |
| 61 #include "net/base/cert_verifier.h" | |
| 61 #include "net/cookies/canonical_cookie.h" | 62 #include "net/cookies/canonical_cookie.h" |
| 62 #include "net/cookies/cookie_monster.h" | 63 #include "net/cookies/cookie_monster.h" |
| 63 #include "net/http/http_transaction_factory.h" | 64 #include "net/http/http_transaction_factory.h" |
| 64 #include "net/http/http_util.h" | 65 #include "net/http/http_util.h" |
| 65 #include "net/proxy/proxy_config_service_fixed.h" | 66 #include "net/proxy/proxy_config_service_fixed.h" |
| 66 #include "net/proxy/proxy_script_fetcher_impl.h" | 67 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 67 #include "net/proxy/proxy_service.h" | 68 #include "net/proxy/proxy_service.h" |
| 68 #include "net/ssl/server_bound_cert_service.h" | 69 #include "net/ssl/server_bound_cert_service.h" |
| 69 #include "net/url_request/data_protocol_handler.h" | 70 #include "net/url_request/data_protocol_handler.h" |
| 70 #include "net/url_request/file_protocol_handler.h" | 71 #include "net/url_request/file_protocol_handler.h" |
| 71 #include "net/url_request/ftp_protocol_handler.h" | 72 #include "net/url_request/ftp_protocol_handler.h" |
| 72 #include "net/url_request/protocol_intercept_job_factory.h" | 73 #include "net/url_request/protocol_intercept_job_factory.h" |
| 73 #include "net/url_request/url_request.h" | 74 #include "net/url_request/url_request.h" |
| 74 #include "net/url_request/url_request_file_job.h" | 75 #include "net/url_request/url_request_file_job.h" |
| 75 #include "net/url_request/url_request_job_factory_impl.h" | 76 #include "net/url_request/url_request_job_factory_impl.h" |
| 76 | 77 |
| 77 #if defined(ENABLE_MANAGED_USERS) | 78 #if defined(ENABLE_MANAGED_USERS) |
| 78 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 79 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
| 79 #include "chrome/browser/managed_mode/managed_user_service.h" | 80 #include "chrome/browser/managed_mode/managed_user_service.h" |
| 80 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 81 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
| 81 #endif | 82 #endif |
| 82 | 83 |
| 83 #if defined(OS_CHROMEOS) | 84 #if defined(OS_CHROMEOS) |
| 84 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 85 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
| 86 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | |
| 87 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | |
| 85 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 88 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 86 #include "chrome/browser/chromeos/settings/cros_settings.h" | 89 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 87 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 90 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 91 #include "chrome/browser/policy/browser_policy_connector.h" | |
| 88 #endif // defined(OS_CHROMEOS) | 92 #endif // defined(OS_CHROMEOS) |
| 89 | 93 |
| 90 using content::BrowserContext; | 94 using content::BrowserContext; |
| 91 using content::BrowserThread; | 95 using content::BrowserThread; |
| 92 using content::ResourceContext; | 96 using content::ResourceContext; |
| 93 | 97 |
| 94 namespace { | 98 namespace { |
| 95 | 99 |
| 96 // ---------------------------------------------------------------------------- | 100 // ---------------------------------------------------------------------------- |
| 97 // CookieMonster::Delegate implementation | 101 // CookieMonster::Delegate implementation |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 ProxyServiceFactory::CreateProxyConfigService(); | 260 ProxyServiceFactory::CreateProxyConfigService(); |
| 257 params->proxy_config_service.reset(proxy_config_service); | 261 params->proxy_config_service.reset(proxy_config_service); |
| 258 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( | 262 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( |
| 259 proxy_config_service); | 263 proxy_config_service); |
| 260 #if defined(ENABLE_MANAGED_USERS) | 264 #if defined(ENABLE_MANAGED_USERS) |
| 261 ManagedUserService* managed_user_service = | 265 ManagedUserService* managed_user_service = |
| 262 ManagedUserServiceFactory::GetForProfile(profile); | 266 ManagedUserServiceFactory::GetForProfile(profile); |
| 263 params->managed_mode_url_filter = | 267 params->managed_mode_url_filter = |
| 264 managed_user_service->GetURLFilterForIOThread(); | 268 managed_user_service->GetURLFilterForIOThread(); |
| 265 #endif | 269 #endif |
| 270 #if defined(OS_CHROMEOS) | |
| 271 policy::BrowserPolicyConnector* connector = | |
| 272 g_browser_process->browser_policy_connector(); | |
| 273 params->trust_anchor_provider = | |
| 274 connector->GetNetworkConfigurationUpdater()->GetCertTrustAnchorProvider(); | |
|
pneubeck (no reviews)
2013/03/26 10:01:25
seeing these many levels of nesting, should we bet
Joao da Silva
2013/03/31 19:22:14
Good idea, done.
| |
| 275 #endif | |
| 266 | 276 |
| 267 params->profile = profile; | 277 params->profile = profile; |
| 268 profile_params_.reset(params.release()); | 278 profile_params_.reset(params.release()); |
| 269 | 279 |
| 270 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 280 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
| 271 &enable_referrers_, | 281 &enable_referrers_, |
| 272 &enable_do_not_track_, | 282 &enable_do_not_track_, |
| 273 &force_safesearch_, | 283 &force_safesearch_, |
| 274 pref_service); | 284 pref_service); |
| 275 | 285 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 set_job_factory(job_factory_.get()); | 375 set_job_factory(job_factory_.get()); |
| 366 } | 376 } |
| 367 | 377 |
| 368 ProfileIOData::AppRequestContext::~AppRequestContext() {} | 378 ProfileIOData::AppRequestContext::~AppRequestContext() {} |
| 369 | 379 |
| 370 ProfileIOData::ProfileParams::ProfileParams() | 380 ProfileIOData::ProfileParams::ProfileParams() |
| 371 : io_thread(NULL), | 381 : io_thread(NULL), |
| 372 #if defined(ENABLE_NOTIFICATIONS) | 382 #if defined(ENABLE_NOTIFICATIONS) |
| 373 notification_service(NULL), | 383 notification_service(NULL), |
| 374 #endif | 384 #endif |
| 385 #if defined(OS_CHROMEOS) | |
| 386 trust_anchor_provider(NULL), | |
| 387 #endif | |
| 375 profile(NULL) { | 388 profile(NULL) { |
| 376 } | 389 } |
| 377 | 390 |
| 378 ProfileIOData::ProfileParams::~ProfileParams() {} | 391 ProfileIOData::ProfileParams::~ProfileParams() {} |
| 379 | 392 |
| 380 ProfileIOData::ProfileIOData(bool is_incognito) | 393 ProfileIOData::ProfileIOData(bool is_incognito) |
| 381 : initialized_(false), | 394 : initialized_(false), |
| 382 #if defined(ENABLE_NOTIFICATIONS) | 395 #if defined(ENABLE_NOTIFICATIONS) |
| 383 notification_service_(NULL), | 396 notification_service_(NULL), |
| 384 #endif | 397 #endif |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 | 700 |
| 688 if (profile_params_->resource_prefetch_predictor_observer_.get()) { | 701 if (profile_params_->resource_prefetch_predictor_observer_.get()) { |
| 689 resource_prefetch_predictor_observer_.reset( | 702 resource_prefetch_predictor_observer_.reset( |
| 690 profile_params_->resource_prefetch_predictor_observer_.release()); | 703 profile_params_->resource_prefetch_predictor_observer_.release()); |
| 691 } | 704 } |
| 692 | 705 |
| 693 #if defined(ENABLE_MANAGED_USERS) | 706 #if defined(ENABLE_MANAGED_USERS) |
| 694 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; | 707 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; |
| 695 #endif | 708 #endif |
| 696 | 709 |
| 710 #if defined(OS_CHROMEOS) | |
| 711 cert_verifier_.reset(new policy::PolicyCertVerifier( | |
| 712 profile_params_->profile, profile_params_->trust_anchor_provider)); | |
| 713 main_request_context_->set_cert_verifier(cert_verifier_.get()); | |
| 714 #else | |
| 715 main_request_context_->set_cert_verifier( | |
| 716 io_thread_globals->cert_verifier.get()); | |
| 717 #endif | |
| 718 | |
| 697 InitializeInternal(profile_params_.get(), protocol_handlers); | 719 InitializeInternal(profile_params_.get(), protocol_handlers); |
| 698 | 720 |
| 699 profile_params_.reset(); | 721 profile_params_.reset(); |
| 700 initialized_ = true; | 722 initialized_ = true; |
| 701 } | 723 } |
| 702 | 724 |
| 703 void ProfileIOData::ApplyProfileParamsToContext( | 725 void ProfileIOData::ApplyProfileParamsToContext( |
| 704 ChromeURLRequestContext* context) const { | 726 ChromeURLRequestContext* context) const { |
| 705 context->set_http_user_agent_settings( | 727 context->set_http_user_agent_settings( |
| 706 chrome_http_user_agent_settings_.get()); | 728 chrome_http_user_agent_settings_.get()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 void ProfileIOData::SetCookieSettingsForTesting( | 858 void ProfileIOData::SetCookieSettingsForTesting( |
| 837 CookieSettings* cookie_settings) { | 859 CookieSettings* cookie_settings) { |
| 838 DCHECK(!cookie_settings_.get()); | 860 DCHECK(!cookie_settings_.get()); |
| 839 cookie_settings_ = cookie_settings; | 861 cookie_settings_ = cookie_settings; |
| 840 } | 862 } |
| 841 | 863 |
| 842 void ProfileIOData::set_signin_names_for_testing( | 864 void ProfileIOData::set_signin_names_for_testing( |
| 843 SigninNamesOnIOThread* signin_names) { | 865 SigninNamesOnIOThread* signin_names) { |
| 844 signin_names_.reset(signin_names); | 866 signin_names_.reset(signin_names); |
| 845 } | 867 } |
| OLD | NEW |