Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 7827033: Introduce net::HttpServerPropertiesManager to manage server-specific properties. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/string_number_conversions.h" 15 #include "base/string_number_conversions.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/content_settings/host_content_settings_map.h" 18 #include "chrome/browser/content_settings/host_content_settings_map.h"
19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 19 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
20 #include "chrome/browser/extensions/extension_info_map.h" 20 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/browser/extensions/extension_protocols.h" 21 #include "chrome/browser/extensions/extension_protocols.h"
22 #include "chrome/browser/io_thread.h" 22 #include "chrome/browser/io_thread.h"
23 #include "chrome/browser/media/media_internals.h" 23 #include "chrome/browser/media/media_internals.h"
24 #include "chrome/browser/net/chrome_cookie_notification_details.h" 24 #include "chrome/browser/net/chrome_cookie_notification_details.h"
25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" 25 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h"
26 #include "chrome/browser/net/chrome_net_log.h" 26 #include "chrome/browser/net/chrome_net_log.h"
27 #include "chrome/browser/net/chrome_network_delegate.h" 27 #include "chrome/browser/net/chrome_network_delegate.h"
28 #include "chrome/browser/net/http_server_properties_manager.h"
28 #include "chrome/browser/net/pref_proxy_config_service.h" 29 #include "chrome/browser/net/pref_proxy_config_service.h"
29 #include "chrome/browser/net/proxy_service_factory.h" 30 #include "chrome/browser/net/proxy_service_factory.h"
30 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 31 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
31 #include "chrome/browser/policy/url_blacklist_manager.h" 32 #include "chrome/browser/policy/url_blacklist_manager.h"
32 #include "chrome/browser/prefs/pref_service.h" 33 #include "chrome/browser/prefs/pref_service.h"
33 #include "chrome/browser/prerender/prerender_manager.h" 34 #include "chrome/browser/prerender/prerender_manager.h"
34 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/profiles/profile_manager.h" 36 #include "chrome/browser/profiles/profile_manager.h"
36 #include "chrome/browser/transport_security_persister.h" 37 #include "chrome/browser/transport_security_persister.h"
37 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 38 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 params->prerender_manager_getter = 248 params->prerender_manager_getter =
248 base::Bind(&GetPrerenderManagerOnUI, profile_getter); 249 base::Bind(&GetPrerenderManagerOnUI, profile_getter);
249 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); 250 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry();
250 251
251 params->proxy_config_service.reset( 252 params->proxy_config_service.reset(
252 ProxyServiceFactory::CreateProxyConfigService( 253 ProxyServiceFactory::CreateProxyConfigService(
253 profile->GetProxyConfigTracker())); 254 profile->GetProxyConfigTracker()));
254 params->profile = profile; 255 params->profile = profile;
255 profile_params_.reset(params.release()); 256 profile_params_.reset(params.release());
256 257
257 // The URLBlacklistManager has to be created on the UI thread to register 258 // URLBlacklistManager and HttpServerPropertiesManager have to be created on
258 // observers of |pref_service|, and it also has to clean up on 259 // the UI thread to register observers of |pref_service|, and it also has to
259 // ShutdownOnUIThread to release these observers on the right thread. 260 // clean up on ShutdownOnUIThread to release these observers on the right
260 // Don't pass it in |profile_params_| to make sure it is correctly cleaned up, 261 // thread. Don't pass it in |profile_params_| to make sure it is correctly
261 // in particular when this ProfileIOData isn't |initialized_| during deletion. 262 // cleaned up, in particular when this ProfileIOData isn't |initialized_|
263 // during deletion.
262 #if defined(ENABLE_CONFIGURATION_POLICY) 264 #if defined(ENABLE_CONFIGURATION_POLICY)
263 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service)); 265 url_blacklist_manager_.reset(new policy::URLBlacklistManager(pref_service));
264 #endif 266 #endif
267 http_server_properties_manager_.reset(
268 new chrome_browser_net::HttpServerPropertiesManager(pref_service));
265 } 269 }
266 270
267 ProfileIOData::AppRequestContext::AppRequestContext() {} 271 ProfileIOData::AppRequestContext::AppRequestContext() {}
268 ProfileIOData::AppRequestContext::~AppRequestContext() {} 272 ProfileIOData::AppRequestContext::~AppRequestContext() {}
269 273
270 void ProfileIOData::AppRequestContext::SetCookieStore( 274 void ProfileIOData::AppRequestContext::SetCookieStore(
271 net::CookieStore* cookie_store) { 275 net::CookieStore* cookie_store) {
272 cookie_store_ = cookie_store; 276 cookie_store_ = cookie_store;
273 set_cookie_store(cookie_store); 277 set_cookie_store(cookie_store);
274 } 278 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 void ProfileIOData::LazyInitialize() const { 404 void ProfileIOData::LazyInitialize() const {
401 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 405 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
402 if (initialized_) 406 if (initialized_)
403 return; 407 return;
404 DCHECK(profile_params_.get()); 408 DCHECK(profile_params_.get());
405 409
406 IOThread* const io_thread = profile_params_->io_thread; 410 IOThread* const io_thread = profile_params_->io_thread;
407 IOThread::Globals* const io_thread_globals = io_thread->globals(); 411 IOThread::Globals* const io_thread_globals = io_thread->globals();
408 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 412 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
409 413
414 if (http_server_properties_manager_.get())
415 http_server_properties_manager_->InitializeOnIOThread();
416
410 // Create the common request contexts. 417 // Create the common request contexts.
411 main_request_context_ = new ChromeURLRequestContext; 418 main_request_context_ = new ChromeURLRequestContext;
412 extensions_request_context_ = new ChromeURLRequestContext; 419 extensions_request_context_ = new ChromeURLRequestContext;
413 420
414 profile_params_->appcache_service->set_request_context(main_request_context_); 421 profile_params_->appcache_service->set_request_context(main_request_context_);
415 422
416 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); 423 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend);
417 424
418 network_delegate_.reset(new ChromeNetworkDelegate( 425 network_delegate_.reset(new ChromeNetworkDelegate(
419 io_thread_globals->extension_event_router_forwarder.get(), 426 io_thread_globals->extension_event_router_forwarder.get(),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 537
531 void ProfileIOData::ShutdownOnUIThread() { 538 void ProfileIOData::ShutdownOnUIThread() {
532 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 539 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
533 enable_referrers_.Destroy(); 540 enable_referrers_.Destroy();
534 clear_local_state_on_exit_.Destroy(); 541 clear_local_state_on_exit_.Destroy();
535 safe_browsing_enabled_.Destroy(); 542 safe_browsing_enabled_.Destroy();
536 #if defined(ENABLE_CONFIGURATION_POLICY) 543 #if defined(ENABLE_CONFIGURATION_POLICY)
537 if (url_blacklist_manager_.get()) 544 if (url_blacklist_manager_.get())
538 url_blacklist_manager_->ShutdownOnUIThread(); 545 url_blacklist_manager_->ShutdownOnUIThread();
539 #endif 546 #endif
547 if (http_server_properties_manager_.get())
548 http_server_properties_manager_->ShutdownOnUIThread();
540 BrowserThread::PostTask( 549 BrowserThread::PostTask(
541 BrowserThread::IO, FROM_HERE, 550 BrowserThread::IO, FROM_HERE,
542 base::Bind( 551 base::Bind(
543 &ResourceDispatcherHost::CancelRequestsForContext, 552 &ResourceDispatcherHost::CancelRequestsForContext,
544 base::Unretained(g_browser_process->resource_dispatcher_host()), 553 base::Unretained(g_browser_process->resource_dispatcher_host()),
545 &resource_context_)); 554 &resource_context_));
546 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 555 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
547 new DeleteTask<ProfileIOData>(this)); 556 new DeleteTask<ProfileIOData>(this));
548 if (!posted) 557 if (!posted)
549 delete this; 558 delete this;
550 } 559 }
551 560
552 void ProfileIOData::set_origin_bound_cert_service( 561 void ProfileIOData::set_origin_bound_cert_service(
553 net::OriginBoundCertService* origin_bound_cert_service) const { 562 net::OriginBoundCertService* origin_bound_cert_service) const {
554 origin_bound_cert_service_.reset(origin_bound_cert_service); 563 origin_bound_cert_service_.reset(origin_bound_cert_service);
555 } 564 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698