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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
57 #include "chrome/common/pref_names.h" | 57 #include "chrome/common/pref_names.h" |
58 #include "chrome/common/url_constants.h" | 58 #include "chrome/common/url_constants.h" |
59 #include "components/startup_metric_utils/startup_metric_utils.h" | 59 #include "components/startup_metric_utils/startup_metric_utils.h" |
60 #include "content/public/browser/browser_thread.h" | 60 #include "content/public/browser/browser_thread.h" |
61 #include "content/public/browser/host_zoom_map.h" | 61 #include "content/public/browser/host_zoom_map.h" |
62 #include "content/public/browser/notification_service.h" | 62 #include "content/public/browser/notification_service.h" |
63 #include "content/public/browser/resource_context.h" | 63 #include "content/public/browser/resource_context.h" |
64 #include "extensions/browser/info_map.h" | 64 #include "extensions/browser/info_map.h" |
65 #include "extensions/common/constants.h" | 65 #include "extensions/common/constants.h" |
66 #include "net/cert/cert_verifier.h" | |
67 #include "net/cookies/canonical_cookie.h" | 66 #include "net/cookies/canonical_cookie.h" |
68 #include "net/cookies/cookie_monster.h" | 67 #include "net/cookies/cookie_monster.h" |
69 #include "net/http/http_transaction_factory.h" | 68 #include "net/http/http_transaction_factory.h" |
70 #include "net/http/http_util.h" | 69 #include "net/http/http_util.h" |
71 #include "net/proxy/proxy_config_service_fixed.h" | 70 #include "net/proxy/proxy_config_service_fixed.h" |
72 #include "net/proxy/proxy_script_fetcher_impl.h" | 71 #include "net/proxy/proxy_script_fetcher_impl.h" |
73 #include "net/proxy/proxy_service.h" | 72 #include "net/proxy/proxy_service.h" |
74 #include "net/ssl/client_cert_store.h" | 73 #include "net/ssl/client_cert_store.h" |
75 #include "net/ssl/client_cert_store_impl.h" | 74 #include "net/ssl/client_cert_store_impl.h" |
76 #include "net/ssl/server_bound_cert_service.h" | 75 #include "net/ssl/server_bound_cert_service.h" |
77 #include "net/url_request/data_protocol_handler.h" | 76 #include "net/url_request/data_protocol_handler.h" |
78 #include "net/url_request/file_protocol_handler.h" | 77 #include "net/url_request/file_protocol_handler.h" |
79 #include "net/url_request/ftp_protocol_handler.h" | 78 #include "net/url_request/ftp_protocol_handler.h" |
80 #include "net/url_request/protocol_intercept_job_factory.h" | 79 #include "net/url_request/protocol_intercept_job_factory.h" |
81 #include "net/url_request/url_request.h" | 80 #include "net/url_request/url_request.h" |
82 #include "net/url_request/url_request_file_job.h" | 81 #include "net/url_request/url_request_file_job.h" |
83 #include "net/url_request/url_request_job_factory_impl.h" | 82 #include "net/url_request/url_request_job_factory_impl.h" |
84 | 83 |
85 #if defined(ENABLE_MANAGED_USERS) | 84 #if defined(ENABLE_MANAGED_USERS) |
86 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 85 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
87 #include "chrome/browser/managed_mode/managed_user_service.h" | 86 #include "chrome/browser/managed_mode/managed_user_service.h" |
88 #include "chrome/browser/managed_mode/managed_user_service_factory.h" | 87 #include "chrome/browser/managed_mode/managed_user_service_factory.h" |
89 #endif | 88 #endif |
90 | 89 |
91 #if defined(OS_CHROMEOS) | 90 #if defined(OS_CHROMEOS) |
92 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" | 91 #include "chrome/browser/chromeos/drive/drive_protocol_handler.h" |
| 92 #include "chrome/browser/chromeos/policy/policy_cert_service.h" |
| 93 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" |
93 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" | 94 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" |
94 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" | |
95 #include "chrome/browser/chromeos/policy/user_network_configuration_updater_fact
ory.h" | |
96 #include "chrome/browser/chromeos/settings/cros_settings.h" | 95 #include "chrome/browser/chromeos/settings/cros_settings.h" |
97 #include "chrome/browser/policy/profile_policy_connector.h" | |
98 #include "chrome/browser/policy/profile_policy_connector_factory.h" | |
99 #include "chromeos/settings/cros_settings_names.h" | 96 #include "chromeos/settings/cros_settings_names.h" |
100 #endif // defined(OS_CHROMEOS) | 97 #endif // defined(OS_CHROMEOS) |
101 | 98 |
102 using content::BrowserContext; | 99 using content::BrowserContext; |
103 using content::BrowserThread; | 100 using content::BrowserThread; |
104 using content::ResourceContext; | 101 using content::ResourceContext; |
105 | 102 |
106 namespace { | 103 namespace { |
107 | 104 |
108 // ---------------------------------------------------------------------------- | 105 // ---------------------------------------------------------------------------- |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 request, network_delegate, path, | 217 request, network_delegate, path, |
221 content::BrowserThread::GetBlockingPool()-> | 218 content::BrowserThread::GetBlockingPool()-> |
222 GetTaskRunnerWithShutdownBehavior( | 219 GetTaskRunnerWithShutdownBehavior( |
223 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 220 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
224 | 221 |
225 return NULL; | 222 return NULL; |
226 } | 223 } |
227 }; | 224 }; |
228 #endif // defined(DEBUG_DEVTOOLS) | 225 #endif // defined(DEBUG_DEVTOOLS) |
229 | 226 |
230 #if defined(OS_CHROMEOS) | |
231 scoped_ptr<policy::PolicyCertVerifier> CreatePolicyCertVerifier( | |
232 Profile* profile) { | |
233 policy::ProfilePolicyConnector* connector = | |
234 policy::ProfilePolicyConnectorFactory::GetForProfile(profile); | |
235 base::Closure policy_cert_trusted_callback = | |
236 base::Bind(base::IgnoreResult(&content::BrowserThread::PostTask), | |
237 content::BrowserThread::UI, | |
238 FROM_HERE, | |
239 connector->GetPolicyCertTrustedCallback()); | |
240 scoped_ptr<policy::PolicyCertVerifier> cert_verifier( | |
241 new policy::PolicyCertVerifier(policy_cert_trusted_callback)); | |
242 policy::UserNetworkConfigurationUpdater* network_configuration_updater = | |
243 policy::UserNetworkConfigurationUpdaterFactory::GetForProfile(profile); | |
244 if (network_configuration_updater) | |
245 network_configuration_updater->SetPolicyCertVerifier(cert_verifier.get()); | |
246 return cert_verifier.Pass(); | |
247 } | |
248 #endif | |
249 } // namespace | 227 } // namespace |
250 | 228 |
251 void ProfileIOData::InitializeOnUIThread(Profile* profile) { | 229 void ProfileIOData::InitializeOnUIThread(Profile* profile) { |
252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 230 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
253 PrefService* pref_service = profile->GetPrefs(); | 231 PrefService* pref_service = profile->GetPrefs(); |
254 PrefService* local_state_pref_service = g_browser_process->local_state(); | 232 PrefService* local_state_pref_service = g_browser_process->local_state(); |
255 | 233 |
256 scoped_ptr<ProfileParams> params(new ProfileParams); | 234 scoped_ptr<ProfileParams> params(new ProfileParams); |
257 params->path = profile->GetPath(); | 235 params->path = profile->GetPath(); |
258 | 236 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 272 |
295 params->proxy_config_service | 273 params->proxy_config_service |
296 .reset(ProxyServiceFactory::CreateProxyConfigService( | 274 .reset(ProxyServiceFactory::CreateProxyConfigService( |
297 profile->GetProxyConfigTracker())); | 275 profile->GetProxyConfigTracker())); |
298 #if defined(ENABLE_MANAGED_USERS) | 276 #if defined(ENABLE_MANAGED_USERS) |
299 ManagedUserService* managed_user_service = | 277 ManagedUserService* managed_user_service = |
300 ManagedUserServiceFactory::GetForProfile(profile); | 278 ManagedUserServiceFactory::GetForProfile(profile); |
301 params->managed_mode_url_filter = | 279 params->managed_mode_url_filter = |
302 managed_user_service->GetURLFilterForIOThread(); | 280 managed_user_service->GetURLFilterForIOThread(); |
303 #endif | 281 #endif |
304 #if defined(OS_CHROMEOS) | |
305 params->cert_verifier = CreatePolicyCertVerifier(profile); | |
306 #endif | |
307 | 282 |
308 params->profile = profile; | 283 params->profile = profile; |
309 profile_params_.reset(params.release()); | 284 profile_params_.reset(params.release()); |
310 | 285 |
311 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 286 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
312 &enable_referrers_, | 287 &enable_referrers_, |
313 &enable_do_not_track_, | 288 &enable_do_not_track_, |
314 &force_safesearch_, | 289 &force_safesearch_, |
315 pref_service); | 290 pref_service); |
316 | 291 |
(...skipping 27 matching lines...) Expand all Loading... |
344 prefs::kReverseAutologinRejectedEmailList, pref_service); | 319 prefs::kReverseAutologinRejectedEmailList, pref_service); |
345 one_click_signin_rejected_email_list_.MoveToThread(io_message_loop_proxy); | 320 one_click_signin_rejected_email_list_.MoveToThread(io_message_loop_proxy); |
346 | 321 |
347 sync_disabled_.Init(prefs::kSyncManaged, pref_service); | 322 sync_disabled_.Init(prefs::kSyncManaged, pref_service); |
348 sync_disabled_.MoveToThread(io_message_loop_proxy); | 323 sync_disabled_.MoveToThread(io_message_loop_proxy); |
349 | 324 |
350 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); | 325 signin_allowed_.Init(prefs::kSigninAllowed, pref_service); |
351 signin_allowed_.MoveToThread(io_message_loop_proxy); | 326 signin_allowed_.MoveToThread(io_message_loop_proxy); |
352 } | 327 } |
353 | 328 |
| 329 #if defined(OS_CHROMEOS) |
| 330 cert_verifier_ = policy::PolicyCertServiceFactory::CreateForProfile(profile); |
| 331 #endif |
354 // The URLBlacklistManager has to be created on the UI thread to register | 332 // The URLBlacklistManager has to be created on the UI thread to register |
355 // observers of |pref_service|, and it also has to clean up on | 333 // observers of |pref_service|, and it also has to clean up on |
356 // ShutdownOnUIThread to release these observers on the right thread. | 334 // ShutdownOnUIThread to release these observers on the right thread. |
357 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 335 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
358 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 336 // in particular when this ProfileIOData isn't |initialized_| during deletion. |
359 #if defined(ENABLE_CONFIGURATION_POLICY) | 337 #if defined(ENABLE_CONFIGURATION_POLICY) |
360 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); | 338 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); |
361 #endif | 339 #endif |
362 | 340 |
363 initialized_on_UI_thread_ = true; | 341 initialized_on_UI_thread_ = true; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 if (profile_params_->resource_prefetch_predictor_observer_) { | 818 if (profile_params_->resource_prefetch_predictor_observer_) { |
841 resource_prefetch_predictor_observer_.reset( | 819 resource_prefetch_predictor_observer_.reset( |
842 profile_params_->resource_prefetch_predictor_observer_.release()); | 820 profile_params_->resource_prefetch_predictor_observer_.release()); |
843 } | 821 } |
844 | 822 |
845 #if defined(ENABLE_MANAGED_USERS) | 823 #if defined(ENABLE_MANAGED_USERS) |
846 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; | 824 managed_mode_url_filter_ = profile_params_->managed_mode_url_filter; |
847 #endif | 825 #endif |
848 | 826 |
849 #if defined(OS_CHROMEOS) | 827 #if defined(OS_CHROMEOS) |
850 profile_params_->cert_verifier->InitializeOnIOThread(); | 828 if (cert_verifier_) { |
851 cert_verifier_ = profile_params_->cert_verifier.Pass(); | 829 cert_verifier_->InitializeOnIOThread(); |
852 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 830 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
| 831 } else { |
| 832 main_request_context_->set_cert_verifier( |
| 833 io_thread_globals->cert_verifier.get()); |
| 834 } |
853 #else | 835 #else |
854 main_request_context_->set_cert_verifier( | 836 main_request_context_->set_cert_verifier( |
855 io_thread_globals->cert_verifier.get()); | 837 io_thread_globals->cert_verifier.get()); |
856 #endif | 838 #endif |
857 | 839 |
858 InitializeInternal(profile_params_.get(), protocol_handlers); | 840 InitializeInternal(profile_params_.get(), protocol_handlers); |
859 | 841 |
860 profile_params_.reset(); | 842 profile_params_.reset(); |
861 initialized_ = true; | 843 initialized_ = true; |
862 } | 844 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 void ProfileIOData::SetCookieSettingsForTesting( | 982 void ProfileIOData::SetCookieSettingsForTesting( |
1001 CookieSettings* cookie_settings) { | 983 CookieSettings* cookie_settings) { |
1002 DCHECK(!cookie_settings_.get()); | 984 DCHECK(!cookie_settings_.get()); |
1003 cookie_settings_ = cookie_settings; | 985 cookie_settings_ = cookie_settings; |
1004 } | 986 } |
1005 | 987 |
1006 void ProfileIOData::set_signin_names_for_testing( | 988 void ProfileIOData::set_signin_names_for_testing( |
1007 SigninNamesOnIOThread* signin_names) { | 989 SigninNamesOnIOThread* signin_names) { |
1008 signin_names_.reset(signin_names); | 990 signin_names_.reset(signin_names); |
1009 } | 991 } |
OLD | NEW |