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