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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); | 196 params->cookie_settings = CookieSettings::Factory::GetForProfile(profile); |
194 params->ssl_config_service = profile->GetSSLConfigService(); | 197 params->ssl_config_service = profile->GetSSLConfigService(); |
195 base::Callback<Profile*(void)> profile_getter = | 198 base::Callback<Profile*(void)> profile_getter = |
196 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), | 199 base::Bind(&GetProfileOnUI, g_browser_process->profile_manager(), |
197 profile); | 200 profile); |
198 params->cookie_monster_delegate = | 201 params->cookie_monster_delegate = |
199 new ChromeCookieMonsterDelegate(profile_getter); | 202 new ChromeCookieMonsterDelegate(profile_getter); |
200 params->extension_info_map = | 203 params->extension_info_map = |
201 ExtensionSystem::Get(profile)->info_map(); | 204 ExtensionSystem::Get(profile)->info_map(); |
202 | 205 |
| 206 if (predictors::ResourcePrefetchPredictor* predictor = |
| 207 predictors::ResourcePrefetchPredictorFactory::GetForProfile( |
| 208 profile)) |
| 209 resource_prefetch_predictor_observer_.reset( |
| 210 new chrome_browser_net::ResourcePrefetchPredictorObserver(predictor)); |
| 211 |
203 #if defined(ENABLE_NOTIFICATIONS) | 212 #if defined(ENABLE_NOTIFICATIONS) |
204 params->notification_service = | 213 params->notification_service = |
205 DesktopNotificationServiceFactory::GetForProfile(profile); | 214 DesktopNotificationServiceFactory::GetForProfile(profile); |
206 #endif | 215 #endif |
207 | 216 |
208 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); | 217 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); |
209 | 218 |
210 ChromeProxyConfigService* proxy_config_service = | 219 ChromeProxyConfigService* proxy_config_service = |
211 ProxyServiceFactory::CreateProxyConfigService(true); | 220 ProxyServiceFactory::CreateProxyConfigService(true); |
212 params->proxy_config_service.reset(proxy_config_service); | 221 params->proxy_config_service.reset(proxy_config_service); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 // Take ownership over these parameters. | 555 // Take ownership over these parameters. |
547 cookie_settings_ = profile_params_->cookie_settings; | 556 cookie_settings_ = profile_params_->cookie_settings; |
548 #if defined(ENABLE_NOTIFICATIONS) | 557 #if defined(ENABLE_NOTIFICATIONS) |
549 notification_service_ = profile_params_->notification_service; | 558 notification_service_ = profile_params_->notification_service; |
550 #endif | 559 #endif |
551 extension_info_map_ = profile_params_->extension_info_map; | 560 extension_info_map_ = profile_params_->extension_info_map; |
552 | 561 |
553 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); | 562 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); |
554 resource_context_->request_context_ = main_request_context_.get(); | 563 resource_context_->request_context_ = main_request_context_.get(); |
555 | 564 |
| 565 if (profile_params_->resource_prefetch_predictor_observer_.get()) |
| 566 resource_prefetch_predictor_observer_.reset( |
| 567 profile_params_->resource_prefetch_predictor_observer_.release()); |
| 568 |
556 LazyInitializeInternal(profile_params_.get()); | 569 LazyInitializeInternal(profile_params_.get()); |
557 | 570 |
558 profile_params_.reset(); | 571 profile_params_.reset(); |
559 initialized_ = true; | 572 initialized_ = true; |
560 } | 573 } |
561 | 574 |
562 void ProfileIOData::ApplyProfileParamsToContext( | 575 void ProfileIOData::ApplyProfileParamsToContext( |
563 ChromeURLRequestContext* context) const { | 576 ChromeURLRequestContext* context) const { |
564 context->set_is_incognito(is_incognito()); | 577 context->set_is_incognito(is_incognito()); |
565 context->set_accept_language(profile_params_->accept_language); | 578 context->set_accept_language(profile_params_->accept_language); |
(...skipping 21 matching lines...) Expand all Loading... |
587 } | 600 } |
588 | 601 |
589 void ProfileIOData::set_server_bound_cert_service( | 602 void ProfileIOData::set_server_bound_cert_service( |
590 net::ServerBoundCertService* server_bound_cert_service) const { | 603 net::ServerBoundCertService* server_bound_cert_service) const { |
591 server_bound_cert_service_.reset(server_bound_cert_service); | 604 server_bound_cert_service_.reset(server_bound_cert_service); |
592 } | 605 } |
593 | 606 |
594 void ProfileIOData::DestroyResourceContext() { | 607 void ProfileIOData::DestroyResourceContext() { |
595 resource_context_.reset(); | 608 resource_context_.reset(); |
596 } | 609 } |
OLD | NEW |