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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/extensions/extension_protocols.h" | 26 #include "chrome/browser/extensions/extension_protocols.h" |
27 #include "chrome/browser/extensions/extension_resource_protocols.h" | 27 #include "chrome/browser/extensions/extension_resource_protocols.h" |
28 #include "chrome/browser/extensions/extension_system.h" | 28 #include "chrome/browser/extensions/extension_system.h" |
29 #include "chrome/browser/io_thread.h" | 29 #include "chrome/browser/io_thread.h" |
30 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 30 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
31 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" | 31 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
32 #include "chrome/browser/net/chrome_net_log.h" | 32 #include "chrome/browser/net/chrome_net_log.h" |
33 #include "chrome/browser/net/chrome_network_delegate.h" | 33 #include "chrome/browser/net/chrome_network_delegate.h" |
34 #include "chrome/browser/net/http_server_properties_manager.h" | 34 #include "chrome/browser/net/http_server_properties_manager.h" |
35 #include "chrome/browser/net/proxy_service_factory.h" | 35 #include "chrome/browser/net/proxy_service_factory.h" |
| 36 #include "chrome/browser/net/resource_prefetch_predictor_observer.h" |
36 #include "chrome/browser/net/transport_security_persister.h" | 37 #include "chrome/browser/net/transport_security_persister.h" |
37 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 38 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
38 #include "chrome/browser/policy/url_blacklist_manager.h" | 39 #include "chrome/browser/policy/url_blacklist_manager.h" |
| 40 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
| 41 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
39 #include "chrome/browser/prefs/pref_service.h" | 42 #include "chrome/browser/prefs/pref_service.h" |
40 #include "chrome/browser/profiles/profile.h" | 43 #include "chrome/browser/profiles/profile.h" |
41 #include "chrome/browser/profiles/profile_manager.h" | 44 #include "chrome/browser/profiles/profile_manager.h" |
42 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 45 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
43 #include "chrome/common/chrome_notification_types.h" | 46 #include "chrome/common/chrome_notification_types.h" |
44 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
46 #include "chrome/common/url_constants.h" | 49 #include "chrome/common/url_constants.h" |
47 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/host_zoom_map.h" | 51 #include "content/public/browser/host_zoom_map.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); | 194 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); |
192 params->ssl_config_service = profile->GetSSLConfigService(); | 195 params->ssl_config_service = profile->GetSSLConfigService(); |
193 base::Callback<Profile*(void)> profile_getter = | 196 base::Callback<Profile*(void)> profile_getter = |
194 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), | 197 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), |
195 profile); | 198 profile); |
196 params->cookie_monster_delegate = | 199 params->cookie_monster_delegate = |
197 new ChromeCookieMonsterDelegate(profile_getter); | 200 new ChromeCookieMonsterDelegate(profile_getter); |
198 params->extension_info_map = | 201 params->extension_info_map = |
199 ExtensionSystem::Get(profile)->info_map(); | 202 ExtensionSystem::Get(profile)->info_map(); |
200 | 203 |
| 204 if (predictors::ResourcePrefetchPredictor* predictor = |
| 205 predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 206 profile)) { |
| 207 resource_prefetch_predictor_observer_.reset( |
| 208 new chrome_browser_net::ResourcePrefetchPredictorObserver(predictor)); |
| 209 } |
| 210 |
201 #if defined(ENABLE_NOTIFICATIONS) | 211 #if defined(ENABLE_NOTIFICATIONS) |
202 params->notification_service = | 212 params->notification_service = |
203 DesktopNotificationServiceFactory::GetForProfile(profile); | 213 DesktopNotificationServiceFactory::GetForProfile(profile); |
204 #endif | 214 #endif |
205 | 215 |
206 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); | 216 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); |
207 | 217 |
208 ChromeProxyConfigService* proxy_config_service = | 218 ChromeProxyConfigService* proxy_config_service = |
209 ProxyServiceFactory::CreateProxyConfigService(true); | 219 ProxyServiceFactory::CreateProxyConfigService(true); |
210 params->proxy_config_service.reset(proxy_config_service); | 220 params->proxy_config_service.reset(proxy_config_service); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // Take ownership over these parameters. | 553 // Take ownership over these parameters. |
544 cookie_settings_ = profile_params_->cookie_settings; | 554 cookie_settings_ = profile_params_->cookie_settings; |
545 #if defined(ENABLE_NOTIFICATIONS) | 555 #if defined(ENABLE_NOTIFICATIONS) |
546 notification_service_ = profile_params_->notification_service; | 556 notification_service_ = profile_params_->notification_service; |
547 #endif | 557 #endif |
548 extension_info_map_ = profile_params_->extension_info_map; | 558 extension_info_map_ = profile_params_->extension_info_map; |
549 | 559 |
550 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); | 560 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); |
551 resource_context_->request_context_ = main_request_context_.get(); | 561 resource_context_->request_context_ = main_request_context_.get(); |
552 | 562 |
| 563 if (profile_params_->resource_prefetch_predictor_observer_.get()) { |
| 564 resource_prefetch_predictor_observer_.reset( |
| 565 profile_params_->resource_prefetch_predictor_observer_.release()); |
| 566 } |
| 567 |
553 LazyInitializeInternal(profile_params_.get()); | 568 LazyInitializeInternal(profile_params_.get()); |
554 | 569 |
555 profile_params_.reset(); | 570 profile_params_.reset(); |
556 initialized_ = true; | 571 initialized_ = true; |
557 } | 572 } |
558 | 573 |
559 void ProfileIOData::ApplyProfileParamsToContext( | 574 void ProfileIOData::ApplyProfileParamsToContext( |
560 ChromeURLRequestContext* context) const { | 575 ChromeURLRequestContext* context) const { |
561 context->set_is_incognito(is_incognito()); | 576 context->set_is_incognito(is_incognito()); |
562 context->set_accept_language(profile_params_->accept_language); | 577 context->set_accept_language(profile_params_->accept_language); |
(...skipping 20 matching lines...) Expand all Loading... |
583 } | 598 } |
584 | 599 |
585 void ProfileIOData::set_server_bound_cert_service( | 600 void ProfileIOData::set_server_bound_cert_service( |
586 net::ServerBoundCertService* server_bound_cert_service) const { | 601 net::ServerBoundCertService* server_bound_cert_service) const { |
587 server_bound_cert_service_.reset(server_bound_cert_service); | 602 server_bound_cert_service_.reset(server_bound_cert_service); |
588 } | 603 } |
589 | 604 |
590 void ProfileIOData::DestroyResourceContext() { | 605 void ProfileIOData::DestroyResourceContext() { |
591 resource_context_.reset(); | 606 resource_context_.reset(); |
592 } | 607 } |
OLD | NEW |