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 <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/devtools/devtools_network_transaction_factory.h" | 34 #include "chrome/browser/devtools/devtools_network_transaction_factory.h" |
35 #include "chrome/browser/download/download_service.h" | 35 #include "chrome/browser/download/download_service.h" |
36 #include "chrome/browser/download/download_service_factory.h" | 36 #include "chrome/browser/download/download_service_factory.h" |
37 #include "chrome/browser/io_thread.h" | 37 #include "chrome/browser/io_thread.h" |
38 #include "chrome/browser/media/media_device_id_salt.h" | 38 #include "chrome/browser/media/media_device_id_salt.h" |
39 #include "chrome/browser/net/chrome_http_user_agent_settings.h" | 39 #include "chrome/browser/net/chrome_http_user_agent_settings.h" |
40 #include "chrome/browser/net/chrome_network_delegate.h" | 40 #include "chrome/browser/net/chrome_network_delegate.h" |
41 #include "chrome/browser/net/chrome_url_request_context_getter.h" | 41 #include "chrome/browser/net/chrome_url_request_context_getter.h" |
42 #include "chrome/browser/net/proxy_service_factory.h" | 42 #include "chrome/browser/net/proxy_service_factory.h" |
43 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" | 43 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
| 44 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" |
| 45 #include "chrome/browser/policy/policy_helpers.h" |
44 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 46 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
45 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 47 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
46 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
47 #include "chrome/browser/profiles/profile_manager.h" | 49 #include "chrome/browser/profiles/profile_manager.h" |
48 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" | 50 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" |
49 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 51 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
50 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 52 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
51 #include "chrome/common/chrome_paths.h" | 53 #include "chrome/common/chrome_paths.h" |
52 #include "chrome/common/chrome_switches.h" | 54 #include "chrome/common/chrome_switches.h" |
53 #include "chrome/common/features.h" | 55 #include "chrome/common/features.h" |
54 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
55 #include "chrome/common/url_constants.h" | 57 #include "chrome/common/url_constants.h" |
56 #include "components/about_handler/about_protocol_handler.h" | 58 #include "components/about_handler/about_protocol_handler.h" |
57 #include "components/content_settings/core/browser/content_settings_provider.h" | 59 #include "components/content_settings/core/browser/content_settings_provider.h" |
58 #include "components/content_settings/core/browser/cookie_settings.h" | 60 #include "components/content_settings/core/browser/cookie_settings.h" |
59 #include "components/content_settings/core/browser/host_content_settings_map.h" | 61 #include "components/content_settings/core/browser/host_content_settings_map.h" |
60 #include "components/cookie_config/cookie_store_util.h" | 62 #include "components/cookie_config/cookie_store_util.h" |
61 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 63 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
62 #include "components/dom_distiller/core/url_constants.h" | 64 #include "components/dom_distiller/core/url_constants.h" |
63 #include "components/metrics/metrics_pref_names.h" | 65 #include "components/metrics/metrics_pref_names.h" |
64 #include "components/net_log/chrome_net_log.h" | 66 #include "components/net_log/chrome_net_log.h" |
| 67 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 68 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| 69 #include "components/policy/core/common/cloud/policy_header_service.h" |
| 70 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
65 #include "components/prefs/pref_service.h" | 71 #include "components/prefs/pref_service.h" |
66 #include "components/signin/core/common/signin_pref_names.h" | 72 #include "components/signin/core/common/signin_pref_names.h" |
67 #include "components/sync_driver/pref_names.h" | 73 #include "components/sync_driver/pref_names.h" |
68 #include "components/url_formatter/url_fixer.h" | 74 #include "components/url_formatter/url_fixer.h" |
69 #include "content/public/browser/browser_thread.h" | 75 #include "content/public/browser/browser_thread.h" |
70 #include "content/public/browser/host_zoom_map.h" | 76 #include "content/public/browser/host_zoom_map.h" |
71 #include "content/public/browser/notification_service.h" | 77 #include "content/public/browser/notification_service.h" |
72 #include "content/public/browser/resource_context.h" | 78 #include "content/public/browser/resource_context.h" |
73 #include "net/base/keygen_handler.h" | 79 #include "net/base/keygen_handler.h" |
74 #include "net/base/network_quality_estimator.h" | 80 #include "net/base/network_quality_estimator.h" |
(...skipping 14 matching lines...) Expand all Loading... |
89 #include "net/url_request/file_protocol_handler.h" | 95 #include "net/url_request/file_protocol_handler.h" |
90 #include "net/url_request/ftp_protocol_handler.h" | 96 #include "net/url_request/ftp_protocol_handler.h" |
91 #include "net/url_request/url_request.h" | 97 #include "net/url_request/url_request.h" |
92 #include "net/url_request/url_request_context.h" | 98 #include "net/url_request/url_request_context.h" |
93 #include "net/url_request/url_request_context_builder.h" | 99 #include "net/url_request/url_request_context_builder.h" |
94 #include "net/url_request/url_request_file_job.h" | 100 #include "net/url_request/url_request_file_job.h" |
95 #include "net/url_request/url_request_intercepting_job_factory.h" | 101 #include "net/url_request/url_request_intercepting_job_factory.h" |
96 #include "net/url_request/url_request_interceptor.h" | 102 #include "net/url_request/url_request_interceptor.h" |
97 #include "net/url_request/url_request_job_factory_impl.h" | 103 #include "net/url_request/url_request_job_factory_impl.h" |
98 | 104 |
99 #if defined(ENABLE_CONFIGURATION_POLICY) | |
100 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" | |
101 #include "chrome/browser/policy/policy_helpers.h" | |
102 #include "components/policy/core/browser/url_blacklist_manager.h" | |
103 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | |
104 #include "components/policy/core/common/cloud/policy_header_service.h" | |
105 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | |
106 #endif | |
107 | |
108 #if defined(ENABLE_EXTENSIONS) | 105 #if defined(ENABLE_EXTENSIONS) |
109 #include "chrome/browser/extensions/extension_cookie_monster_delegate.h" | 106 #include "chrome/browser/extensions/extension_cookie_monster_delegate.h" |
110 #include "chrome/browser/extensions/extension_resource_protocols.h" | 107 #include "chrome/browser/extensions/extension_resource_protocols.h" |
111 #include "extensions/browser/extension_protocols.h" | 108 #include "extensions/browser/extension_protocols.h" |
112 #include "extensions/browser/extension_system.h" | 109 #include "extensions/browser/extension_system.h" |
113 #include "extensions/browser/extension_throttle_manager.h" | 110 #include "extensions/browser/extension_throttle_manager.h" |
114 #include "extensions/browser/info_map.h" | 111 #include "extensions/browser/info_map.h" |
115 #include "extensions/common/constants.h" | 112 #include "extensions/common/constants.h" |
116 #endif | 113 #endif |
117 | 114 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 scoped_ptr<policy::PolicyCertVerifier> verifier = | 508 scoped_ptr<policy::PolicyCertVerifier> verifier = |
512 policy::PolicyCertServiceFactory::CreateForProfile(profile); | 509 policy::PolicyCertServiceFactory::CreateForProfile(profile); |
513 policy_cert_verifier_ = verifier.get(); | 510 policy_cert_verifier_ = verifier.get(); |
514 cert_verifier_ = std::move(verifier); | 511 cert_verifier_ = std::move(verifier); |
515 #endif | 512 #endif |
516 // The URLBlacklistManager has to be created on the UI thread to register | 513 // The URLBlacklistManager has to be created on the UI thread to register |
517 // observers of |pref_service|, and it also has to clean up on | 514 // observers of |pref_service|, and it also has to clean up on |
518 // ShutdownOnUIThread to release these observers on the right thread. | 515 // ShutdownOnUIThread to release these observers on the right thread. |
519 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, | 516 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, |
520 // in particular when this ProfileIOData isn't |initialized_| during deletion. | 517 // in particular when this ProfileIOData isn't |initialized_| during deletion. |
521 #if defined(ENABLE_CONFIGURATION_POLICY) | |
522 policy::URLBlacklist::SegmentURLCallback callback = | 518 policy::URLBlacklist::SegmentURLCallback callback = |
523 static_cast<policy::URLBlacklist::SegmentURLCallback>( | 519 static_cast<policy::URLBlacklist::SegmentURLCallback>( |
524 url_formatter::SegmentURL); | 520 url_formatter::SegmentURL); |
525 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 521 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
526 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 522 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
527 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 523 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
528 url_blacklist_manager_.reset(new policy::URLBlacklistManager( | 524 url_blacklist_manager_.reset(new policy::URLBlacklistManager( |
529 pref_service, background_task_runner, io_task_runner, callback, | 525 pref_service, background_task_runner, io_task_runner, callback, |
530 base::Bind(policy::OverrideBlacklistForURL))); | 526 base::Bind(policy::OverrideBlacklistForURL))); |
531 | 527 |
532 if (!IsOffTheRecord()) { | 528 if (!IsOffTheRecord()) { |
533 // Add policy headers for non-incognito requests. | 529 // Add policy headers for non-incognito requests. |
534 policy::PolicyHeaderService* policy_header_service = | 530 policy::PolicyHeaderService* policy_header_service = |
535 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 531 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
536 if (policy_header_service) { | 532 if (policy_header_service) { |
537 policy_header_helper_ = | 533 policy_header_helper_ = |
538 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); | 534 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); |
539 } | 535 } |
540 } | 536 } |
541 #endif | |
542 | 537 |
543 incognito_availibility_pref_.Init( | 538 incognito_availibility_pref_.Init( |
544 prefs::kIncognitoModeAvailability, pref_service); | 539 prefs::kIncognitoModeAvailability, pref_service); |
545 incognito_availibility_pref_.MoveToThread(io_task_runner); | 540 incognito_availibility_pref_.MoveToThread(io_task_runner); |
546 | 541 |
547 initialized_on_UI_thread_ = true; | 542 initialized_on_UI_thread_ = true; |
548 | 543 |
549 // We need to make sure that content initializes its own data structures that | 544 // We need to make sure that content initializes its own data structures that |
550 // are associated with each ResourceContext because we might post this | 545 // are associated with each ResourceContext because we might post this |
551 // object to the IO thread after this function. | 546 // object to the IO thread after this function. |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1031 &enable_referrers_)); | 1026 &enable_referrers_)); |
1032 #if defined(ENABLE_EXTENSIONS) | 1027 #if defined(ENABLE_EXTENSIONS) |
1033 network_delegate->set_extension_info_map( | 1028 network_delegate->set_extension_info_map( |
1034 profile_params_->extension_info_map.get()); | 1029 profile_params_->extension_info_map.get()); |
1035 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) { | 1030 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) { |
1036 extension_throttle_manager_.reset( | 1031 extension_throttle_manager_.reset( |
1037 new extensions::ExtensionThrottleManager()); | 1032 new extensions::ExtensionThrottleManager()); |
1038 } | 1033 } |
1039 #endif | 1034 #endif |
1040 | 1035 |
1041 #if defined(ENABLE_CONFIGURATION_POLICY) | |
1042 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 1036 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1043 #endif | |
1044 network_delegate->set_profile(profile_params_->profile); | 1037 network_delegate->set_profile(profile_params_->profile); |
1045 network_delegate->set_profile_path(profile_params_->path); | 1038 network_delegate->set_profile_path(profile_params_->path); |
1046 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 1039 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
1047 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 1040 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
1048 network_delegate->set_force_google_safe_search(&force_google_safesearch_); | 1041 network_delegate->set_force_google_safe_search(&force_google_safesearch_); |
1049 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); | 1042 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); |
1050 network_delegate->set_data_use_aggregator( | 1043 network_delegate->set_data_use_aggregator( |
1051 io_thread_globals->data_use_aggregator.get(), IsOffTheRecord()); | 1044 io_thread_globals->data_use_aggregator.get(), IsOffTheRecord()); |
1052 | 1045 |
1053 // NOTE: Proxy service uses the default io thread network delegate, not the | 1046 // NOTE: Proxy service uses the default io thread network delegate, not the |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 force_youtube_safety_mode_.Destroy(); | 1246 force_youtube_safety_mode_.Destroy(); |
1254 enable_metrics_.Destroy(); | 1247 enable_metrics_.Destroy(); |
1255 safe_browsing_enabled_.Destroy(); | 1248 safe_browsing_enabled_.Destroy(); |
1256 sync_disabled_.Destroy(); | 1249 sync_disabled_.Destroy(); |
1257 signin_allowed_.Destroy(); | 1250 signin_allowed_.Destroy(); |
1258 network_prediction_options_.Destroy(); | 1251 network_prediction_options_.Destroy(); |
1259 quick_check_enabled_.Destroy(); | 1252 quick_check_enabled_.Destroy(); |
1260 if (media_device_id_salt_.get()) | 1253 if (media_device_id_salt_.get()) |
1261 media_device_id_salt_->ShutdownOnUIThread(); | 1254 media_device_id_salt_->ShutdownOnUIThread(); |
1262 session_startup_pref_.Destroy(); | 1255 session_startup_pref_.Destroy(); |
1263 #if defined(ENABLE_CONFIGURATION_POLICY) | |
1264 if (url_blacklist_manager_) | 1256 if (url_blacklist_manager_) |
1265 url_blacklist_manager_->ShutdownOnUIThread(); | 1257 url_blacklist_manager_->ShutdownOnUIThread(); |
1266 #endif | |
1267 if (chrome_http_user_agent_settings_) | 1258 if (chrome_http_user_agent_settings_) |
1268 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 1259 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
1269 incognito_availibility_pref_.Destroy(); | 1260 incognito_availibility_pref_.Destroy(); |
1270 | 1261 |
1271 if (!context_getters->empty()) { | 1262 if (!context_getters->empty()) { |
1272 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 1263 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
1273 BrowserThread::PostTask( | 1264 BrowserThread::PostTask( |
1274 BrowserThread::IO, FROM_HERE, | 1265 BrowserThread::IO, FROM_HERE, |
1275 base::Bind(&NotifyContextGettersOfShutdownOnIO, | 1266 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
1276 base::Passed(&context_getters))); | 1267 base::Passed(&context_getters))); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 make_scoped_ptr(new DevToolsNetworkTransactionFactory( | 1319 make_scoped_ptr(new DevToolsNetworkTransactionFactory( |
1329 network_controller_handle_.GetController(), shared_session)), | 1320 network_controller_handle_.GetController(), shared_session)), |
1330 std::move(backend), true /* set_up_quic_server_info */)); | 1321 std::move(backend), true /* set_up_quic_server_info */)); |
1331 } | 1322 } |
1332 | 1323 |
1333 void ProfileIOData::SetCookieSettingsForTesting( | 1324 void ProfileIOData::SetCookieSettingsForTesting( |
1334 content_settings::CookieSettings* cookie_settings) { | 1325 content_settings::CookieSettings* cookie_settings) { |
1335 DCHECK(!cookie_settings_.get()); | 1326 DCHECK(!cookie_settings_.get()); |
1336 cookie_settings_ = cookie_settings; | 1327 cookie_settings_ = cookie_settings; |
1337 } | 1328 } |
OLD | NEW |