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

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

Issue 7716003: WIP: URL blacklisting by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewed Created 9 years, 3 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
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 10 matching lines...) Expand all
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/pref_proxy_config_service.h" 28 #include "chrome/browser/net/pref_proxy_config_service.h"
29 #include "chrome/browser/net/proxy_service_factory.h" 29 #include "chrome/browser/net/proxy_service_factory.h"
30 #include "chrome/browser/notifications/desktop_notification_service_factory.h" 30 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
31 #include "chrome/browser/policy/url_blacklist_manager.h"
31 #include "chrome/browser/prefs/pref_service.h" 32 #include "chrome/browser/prefs/pref_service.h"
32 #include "chrome/browser/prerender/prerender_manager.h" 33 #include "chrome/browser/prerender/prerender_manager.h"
33 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
34 #include "chrome/browser/profiles/profile_manager.h" 35 #include "chrome/browser/profiles/profile_manager.h"
35 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" 36 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
36 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.h"
37 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
40 #include "content/browser/appcache/chrome_appcache_service.h" 41 #include "content/browser/appcache/chrome_appcache_service.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 params->blob_storage_context = profile->GetBlobStorageContext(); 237 params->blob_storage_context = profile->GetBlobStorageContext();
237 params->file_system_context = profile->GetFileSystemContext(); 238 params->file_system_context = profile->GetFileSystemContext();
238 params->quota_manager = profile->GetQuotaManager(); 239 params->quota_manager = profile->GetQuotaManager();
239 params->extension_info_map = profile->GetExtensionInfoMap(); 240 params->extension_info_map = profile->GetExtensionInfoMap();
240 params->notification_service = 241 params->notification_service =
241 DesktopNotificationServiceFactory::GetForProfile(profile); 242 DesktopNotificationServiceFactory::GetForProfile(profile);
242 params->prerender_manager_getter = 243 params->prerender_manager_getter =
243 base::Bind(&GetPrerenderManagerOnUI, profile_getter); 244 base::Bind(&GetPrerenderManagerOnUI, profile_getter);
244 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); 245 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry();
245 246
247 #if defined(ENABLE_CONFIGURATION_POLICY)
248 params->url_blacklist_manager.reset(
249 new policy::URLBlacklistManager(profile));
250 #endif
251
246 params->proxy_config_service.reset( 252 params->proxy_config_service.reset(
247 ProxyServiceFactory::CreateProxyConfigService( 253 ProxyServiceFactory::CreateProxyConfigService(
248 profile->GetProxyConfigTracker())); 254 profile->GetProxyConfigTracker()));
249 params->profile = profile; 255 params->profile = profile;
250 profile_params_.reset(params.release()); 256 profile_params_.reset(params.release());
251 } 257 }
252 258
253 ProfileIOData::AppRequestContext::AppRequestContext() {} 259 ProfileIOData::AppRequestContext::AppRequestContext() {}
254 ProfileIOData::AppRequestContext::~AppRequestContext() {} 260 ProfileIOData::AppRequestContext::~AppRequestContext() {}
255 261
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 main_request_context_ = new ChromeURLRequestContext; 403 main_request_context_ = new ChromeURLRequestContext;
398 extensions_request_context_ = new ChromeURLRequestContext; 404 extensions_request_context_ = new ChromeURLRequestContext;
399 405
400 profile_params_->appcache_service->set_request_context(main_request_context_); 406 profile_params_->appcache_service->set_request_context(main_request_context_);
401 407
402 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend); 408 chrome_url_data_manager_backend_.reset(new ChromeURLDataManagerBackend);
403 409
404 network_delegate_.reset(new ChromeNetworkDelegate( 410 network_delegate_.reset(new ChromeNetworkDelegate(
405 io_thread_globals->extension_event_router_forwarder.get(), 411 io_thread_globals->extension_event_router_forwarder.get(),
406 profile_params_->extension_info_map, 412 profile_params_->extension_info_map,
413 profile_params_->url_blacklist_manager.get(),
407 profile_params_->profile, 414 profile_params_->profile,
408 &enable_referrers_)); 415 &enable_referrers_));
409 416
410 dns_cert_checker_.reset( 417 dns_cert_checker_.reset(
411 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), 418 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(),
412 main_request_context_)); 419 main_request_context_));
413 420
414 proxy_service_.reset( 421 proxy_service_.reset(
415 ProxyServiceFactory::CreateProxyService( 422 ProxyServiceFactory::CreateProxyService(
416 io_thread->net_log(), 423 io_thread->net_log(),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 database_tracker_ = profile_params_->database_tracker; 473 database_tracker_ = profile_params_->database_tracker;
467 appcache_service_ = profile_params_->appcache_service; 474 appcache_service_ = profile_params_->appcache_service;
468 blob_storage_context_ = profile_params_->blob_storage_context; 475 blob_storage_context_ = profile_params_->blob_storage_context;
469 file_system_context_ = profile_params_->file_system_context; 476 file_system_context_ = profile_params_->file_system_context;
470 quota_manager_ = profile_params_->quota_manager; 477 quota_manager_ = profile_params_->quota_manager;
471 host_zoom_map_ = profile_params_->host_zoom_map; 478 host_zoom_map_ = profile_params_->host_zoom_map;
472 host_content_settings_map_ = profile_params_->host_content_settings_map; 479 host_content_settings_map_ = profile_params_->host_content_settings_map;
473 notification_service_ = profile_params_->notification_service; 480 notification_service_ = profile_params_->notification_service;
474 extension_info_map_ = profile_params_->extension_info_map; 481 extension_info_map_ = profile_params_->extension_info_map;
475 prerender_manager_getter_ = profile_params_->prerender_manager_getter; 482 prerender_manager_getter_ = profile_params_->prerender_manager_getter;
483 url_blacklist_manager_.swap(profile_params_->url_blacklist_manager);
476 484
477 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); 485 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get());
478 resource_context_.set_request_context(main_request_context_); 486 resource_context_.set_request_context(main_request_context_);
479 resource_context_.set_database_tracker(database_tracker_); 487 resource_context_.set_database_tracker(database_tracker_);
480 resource_context_.set_appcache_service(appcache_service_); 488 resource_context_.set_appcache_service(appcache_service_);
481 resource_context_.set_blob_storage_context(blob_storage_context_); 489 resource_context_.set_blob_storage_context(blob_storage_context_);
482 resource_context_.set_file_system_context(file_system_context_); 490 resource_context_.set_file_system_context(file_system_context_);
483 resource_context_.set_quota_manager(quota_manager_); 491 resource_context_.set_quota_manager(quota_manager_);
484 resource_context_.set_host_zoom_map(host_zoom_map_); 492 resource_context_.set_host_zoom_map(host_zoom_map_);
485 resource_context_.set_prerender_manager_getter(prerender_manager_getter_); 493 resource_context_.set_prerender_manager_getter(prerender_manager_getter_);
486 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this)); 494 resource_context_.SetUserData(NULL, const_cast<ProfileIOData*>(this));
487 resource_context_.set_media_observer( 495 resource_context_.set_media_observer(
488 io_thread_globals->media.media_internals.get()); 496 io_thread_globals->media.media_internals.get());
489 497
498 if (url_blacklist_manager_.get())
499 url_blacklist_manager_->InitializeOnIOThread();
500
490 LazyInitializeInternal(profile_params_.get()); 501 LazyInitializeInternal(profile_params_.get());
491 502
492 profile_params_.reset(); 503 profile_params_.reset();
493 initialized_ = true; 504 initialized_ = true;
494 } 505 }
495 506
496 void ProfileIOData::ApplyProfileParamsToContext( 507 void ProfileIOData::ApplyProfileParamsToContext(
497 ChromeURLRequestContext* context) const { 508 ChromeURLRequestContext* context) const {
498 context->set_is_incognito(profile_params_->is_incognito); 509 context->set_is_incognito(profile_params_->is_incognito);
499 context->set_accept_language(profile_params_->accept_language); 510 context->set_accept_language(profile_params_->accept_language);
500 context->set_accept_charset(profile_params_->accept_charset); 511 context->set_accept_charset(profile_params_->accept_charset);
501 context->set_referrer_charset(profile_params_->referrer_charset); 512 context->set_referrer_charset(profile_params_->referrer_charset);
502 context->set_transport_security_state( 513 context->set_transport_security_state(
503 profile_params_->transport_security_state); 514 profile_params_->transport_security_state);
504 context->set_ssl_config_service(profile_params_->ssl_config_service); 515 context->set_ssl_config_service(profile_params_->ssl_config_service);
505 } 516 }
506 517
507 void ProfileIOData::ShutdownOnUIThread() { 518 void ProfileIOData::ShutdownOnUIThread() {
508 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 519 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
509 enable_referrers_.Destroy(); 520 enable_referrers_.Destroy();
510 clear_local_state_on_exit_.Destroy(); 521 clear_local_state_on_exit_.Destroy();
511 safe_browsing_enabled_.Destroy(); 522 safe_browsing_enabled_.Destroy();
523 if (url_blacklist_manager_.get())
524 url_blacklist_manager_->ShutdownOnUIThread();
512 BrowserThread::PostTask( 525 BrowserThread::PostTask(
513 BrowserThread::IO, FROM_HERE, 526 BrowserThread::IO, FROM_HERE,
514 base::Bind( 527 base::Bind(
515 &ResourceDispatcherHost::CancelRequestsForContext, 528 &ResourceDispatcherHost::CancelRequestsForContext,
516 base::Unretained(g_browser_process->resource_dispatcher_host()), 529 base::Unretained(g_browser_process->resource_dispatcher_host()),
517 &resource_context_)); 530 &resource_context_));
518 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 531 bool posted = BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
519 new DeleteTask<ProfileIOData>(this)); 532 new DeleteTask<ProfileIOData>(this));
520 if (!posted) 533 if (!posted)
521 delete this; 534 delete this;
522 } 535 }
523 536
524 void ProfileIOData::set_origin_bound_cert_service( 537 void ProfileIOData::set_origin_bound_cert_service(
525 net::OriginBoundCertService* origin_bound_cert_service) const { 538 net::OriginBoundCertService* origin_bound_cert_service) const {
526 origin_bound_cert_service_.reset(origin_bound_cert_service); 539 origin_bound_cert_service_.reset(origin_bound_cert_service);
527 } 540 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698