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/cert/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/policy_cert_verifier.h" |
85 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 87 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
86 #include "chrome/browser/chromeos/settings/cros_settings.h" | 88 #include "chrome/browser/chromeos/settings/cros_settings.h" |
87 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 89 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 90 #include "chrome/browser/policy/browser_policy_connector.h" |
88 #endif // defined(OS_CHROMEOS) | 91 #endif // defined(OS_CHROMEOS) |
89 | 92 |
90 using content::BrowserContext; | 93 using content::BrowserContext; |
91 using content::BrowserThread; | 94 using content::BrowserThread; |
92 using content::ResourceContext; | 95 using content::ResourceContext; |
93 | 96 |
94 namespace { | 97 namespace { |
95 | 98 |
96 // ---------------------------------------------------------------------------- | 99 // ---------------------------------------------------------------------------- |
97 // CookieMonster::Delegate implementation | 100 // CookieMonster::Delegate implementation |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 ProxyServiceFactory::CreateProxyConfigService(); | 260 ProxyServiceFactory::CreateProxyConfigService(); |
258 params->proxy_config_service.reset(proxy_config_service); | 261 params->proxy_config_service.reset(proxy_config_service); |
259 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( | 262 profile->GetProxyConfigTracker()->SetChromeProxyConfigService( |
260 proxy_config_service); | 263 proxy_config_service); |
261 #if defined(ENABLE_MANAGED_USERS) | 264 #if defined(ENABLE_MANAGED_USERS) |
262 ManagedUserService* managed_user_service = | 265 ManagedUserService* managed_user_service = |
263 ManagedUserServiceFactory::GetForProfile(profile); | 266 ManagedUserServiceFactory::GetForProfile(profile); |
264 params->managed_mode_url_filter = | 267 params->managed_mode_url_filter = |
265 managed_user_service->GetURLFilterForIOThread(); | 268 managed_user_service->GetURLFilterForIOThread(); |
266 #endif | 269 #endif |
| 270 #if defined(OS_CHROMEOS) |
| 271 policy::BrowserPolicyConnector* connector = |
| 272 g_browser_process->browser_policy_connector(); |
| 273 params->trust_anchor_provider = connector->GetCertTrustAnchorProvider(); |
| 274 #endif |
267 | 275 |
268 params->profile = profile; | 276 params->profile = profile; |
269 profile_params_.reset(params.release()); | 277 profile_params_.reset(params.release()); |
270 | 278 |
271 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 279 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
272 &enable_referrers_, | 280 &enable_referrers_, |
273 &enable_do_not_track_, | 281 &enable_do_not_track_, |
274 &force_safesearch_, | 282 &force_safesearch_, |
275 pref_service); | 283 pref_service); |
276 | 284 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 set_job_factory(job_factory_.get()); | 374 set_job_factory(job_factory_.get()); |
367 } | 375 } |
368 | 376 |
369 ProfileIOData::AppRequestContext::~AppRequestContext() {} | 377 ProfileIOData::AppRequestContext::~AppRequestContext() {} |
370 | 378 |
371 ProfileIOData::ProfileParams::ProfileParams() | 379 ProfileIOData::ProfileParams::ProfileParams() |
372 : io_thread(NULL), | 380 : io_thread(NULL), |
373 #if defined(ENABLE_NOTIFICATIONS) | 381 #if defined(ENABLE_NOTIFICATIONS) |
374 notification_service(NULL), | 382 notification_service(NULL), |
375 #endif | 383 #endif |
| 384 #if defined(OS_CHROMEOS) |
| 385 trust_anchor_provider(NULL), |
| 386 #endif |
376 profile(NULL) { | 387 profile(NULL) { |
377 } | 388 } |
378 | 389 |
379 ProfileIOData::ProfileParams::~ProfileParams() {} | 390 ProfileIOData::ProfileParams::~ProfileParams() {} |
380 | 391 |
381 ProfileIOData::ProfileIOData(bool is_incognito) | 392 ProfileIOData::ProfileIOData(bool is_incognito) |
382 : initialized_(false), | 393 : initialized_(false), |
383 #if defined(ENABLE_NOTIFICATIONS) | 394 #if defined(ENABLE_NOTIFICATIONS) |
384 notification_service_(NULL), | 395 notification_service_(NULL), |
385 #endif | 396 #endif |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 699 |
689 if (profile_params_->resource_prefetch_predictor_observer_.get()) { | 700 if (profile_params_->resource_prefetch_predictor_observer_.get()) { |
690 resource_prefetch_predictor_observer_.reset( | 701 resource_prefetch_predictor_observer_.reset( |
691 profile_params_->resource_prefetch_predictor_observer_.release()); | 702 profile_params_->resource_prefetch_predictor_observer_.release()); |
692 } | 703 } |
693 | 704 |
694 #if defined(ENABLE_MANAGED_USERS) | 705 #if defined(ENABLE_MANAGED_USERS) |
695 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; | 706 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; |
696 #endif | 707 #endif |
697 | 708 |
| 709 #if defined(OS_CHROMEOS) |
| 710 cert_verifier_.reset(new policy::PolicyCertVerifier( |
| 711 profile_params_->profile, profile_params_->trust_anchor_provider)); |
| 712 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
| 713 #else |
| 714 main_request_context_->set_cert_verifier( |
| 715 io_thread_globals->cert_verifier.get()); |
| 716 #endif |
| 717 |
698 InitializeInternal(profile_params_.get(), protocol_handlers); | 718 InitializeInternal(profile_params_.get(), protocol_handlers); |
699 | 719 |
700 profile_params_.reset(); | 720 profile_params_.reset(); |
701 initialized_ = true; | 721 initialized_ = true; |
702 } | 722 } |
703 | 723 |
704 void ProfileIOData::ApplyProfileParamsToContext( | 724 void ProfileIOData::ApplyProfileParamsToContext( |
705 ChromeURLRequestContext* context) const { | 725 ChromeURLRequestContext* context) const { |
706 context->set_http_user_agent_settings( | 726 context->set_http_user_agent_settings( |
707 chrome_http_user_agent_settings_.get()); | 727 chrome_http_user_agent_settings_.get()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 void ProfileIOData::SetCookieSettingsForTesting( | 857 void ProfileIOData::SetCookieSettingsForTesting( |
838 CookieSettings* cookie_settings) { | 858 CookieSettings* cookie_settings) { |
839 DCHECK(!cookie_settings_.get()); | 859 DCHECK(!cookie_settings_.get()); |
840 cookie_settings_ = cookie_settings; | 860 cookie_settings_ = cookie_settings; |
841 } | 861 } |
842 | 862 |
843 void ProfileIOData::set_signin_names_for_testing( | 863 void ProfileIOData::set_signin_names_for_testing( |
844 SigninNamesOnIOThread* signin_names) { | 864 SigninNamesOnIOThread* signin_names) { |
845 signin_names_.reset(signin_names); | 865 signin_names_.reset(signin_names); |
846 } | 866 } |
OLD | NEW |