OLD | NEW |
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/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/stl_util-inl.h" | 13 #include "base/stl_util-inl.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/content_settings/host_content_settings_map.h" | 16 #include "chrome/browser/content_settings/host_content_settings_map.h" |
17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 17 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
18 #include "chrome/browser/extensions/extension_protocols.h" | 18 #include "chrome/browser/extensions/extension_protocols.h" |
19 #include "chrome/browser/extensions/user_script_master.h" | 19 #include "chrome/browser/extensions/user_script_master.h" |
20 #include "chrome/browser/io_thread.h" | 20 #include "chrome/browser/io_thread.h" |
21 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 21 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" | 22 #include "chrome/browser/net/chrome_dns_cert_provenance_checker_factory.h" |
23 #include "chrome/browser/net/chrome_net_log.h" | 23 #include "chrome/browser/net/chrome_net_log.h" |
24 #include "chrome/browser/net/chrome_network_delegate.h" | 24 #include "chrome/browser/net/chrome_network_delegate.h" |
25 #include "chrome/browser/net/metadata_url_request.h" | 25 #include "chrome/browser/net/metadata_url_request.h" |
26 #include "chrome/browser/net/pref_proxy_config_service.h" | 26 #include "chrome/browser/net/pref_proxy_config_service.h" |
27 #include "chrome/browser/net/proxy_service_factory.h" | 27 #include "chrome/browser/net/proxy_service_factory.h" |
| 28 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
28 #include "chrome/browser/prefs/pref_service.h" | 29 #include "chrome/browser/prefs/pref_service.h" |
29 #include "chrome/browser/prerender/prerender_manager.h" | 30 #include "chrome/browser/prerender/prerender_manager.h" |
30 #include "chrome/browser/profiles/profile.h" | 31 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 32 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
32 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
35 #include "content/browser/browser_thread.h" | 36 #include "content/browser/browser_thread.h" |
36 #include "content/browser/host_zoom_map.h" | 37 #include "content/browser/host_zoom_map.h" |
37 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 38 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 params->host_zoom_map = profile->GetHostZoomMap(); | 243 params->host_zoom_map = profile->GetHostZoomMap(); |
243 params->transport_security_state = profile->GetTransportSecurityState(); | 244 params->transport_security_state = profile->GetTransportSecurityState(); |
244 params->ssl_config_service = profile->GetSSLConfigService(); | 245 params->ssl_config_service = profile->GetSSLConfigService(); |
245 params->cookie_monster_delegate = new ChromeCookieMonsterDelegate(profile); | 246 params->cookie_monster_delegate = new ChromeCookieMonsterDelegate(profile); |
246 params->database_tracker = profile->GetDatabaseTracker(); | 247 params->database_tracker = profile->GetDatabaseTracker(); |
247 params->appcache_service = profile->GetAppCacheService(); | 248 params->appcache_service = profile->GetAppCacheService(); |
248 params->blob_storage_context = profile->GetBlobStorageContext(); | 249 params->blob_storage_context = profile->GetBlobStorageContext(); |
249 params->file_system_context = profile->GetFileSystemContext(); | 250 params->file_system_context = profile->GetFileSystemContext(); |
250 params->quota_manager = profile->GetQuotaManager(); | 251 params->quota_manager = profile->GetQuotaManager(); |
251 params->extension_info_map = profile->GetExtensionInfoMap(); | 252 params->extension_info_map = profile->GetExtensionInfoMap(); |
| 253 params->notification_service = |
| 254 DesktopNotificationServiceFactory::GetForProfile(profile); |
252 prerender::PrerenderManager* prerender_manager = | 255 prerender::PrerenderManager* prerender_manager = |
253 profile->GetPrerenderManager(); | 256 profile->GetPrerenderManager(); |
254 if (prerender_manager) | 257 if (prerender_manager) |
255 params->prerender_manager = prerender_manager->AsWeakPtr(); | 258 params->prerender_manager = prerender_manager->AsWeakPtr(); |
256 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); | 259 params->protocol_handler_registry = profile->GetProtocolHandlerRegistry(); |
257 | 260 |
258 params->proxy_config_service.reset( | 261 params->proxy_config_service.reset( |
259 ProxyServiceFactory::CreateProxyConfigService( | 262 ProxyServiceFactory::CreateProxyConfigService( |
260 profile->GetProxyConfigTracker())); | 263 profile->GetProxyConfigTracker())); |
261 params->profile_id = profile->GetRuntimeId(); | 264 params->profile_id = profile->GetRuntimeId(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 scoped_refptr<ChromeURLRequestContext> context = | 356 scoped_refptr<ChromeURLRequestContext> context = |
354 AcquireIsolatedAppRequestContext(main_context, app_id); | 357 AcquireIsolatedAppRequestContext(main_context, app_id); |
355 DCHECK(context); | 358 DCHECK(context); |
356 return context; | 359 return context; |
357 } | 360 } |
358 | 361 |
359 const content::ResourceContext& ProfileIOData::GetResourceContext() const { | 362 const content::ResourceContext& ProfileIOData::GetResourceContext() const { |
360 return resource_context_; | 363 return resource_context_; |
361 } | 364 } |
362 | 365 |
| 366 ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const { |
| 367 return extension_info_map_; |
| 368 } |
| 369 |
363 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { | 370 HostContentSettingsMap* ProfileIOData::GetHostContentSettingsMap() const { |
364 return host_content_settings_map_; | 371 return host_content_settings_map_; |
365 } | 372 } |
366 | 373 |
| 374 DesktopNotificationService* ProfileIOData::GetNotificationService() const { |
| 375 return notification_service_; |
| 376 } |
| 377 |
367 ProfileIOData::ResourceContext::ResourceContext(const ProfileIOData* io_data) | 378 ProfileIOData::ResourceContext::ResourceContext(const ProfileIOData* io_data) |
368 : io_data_(io_data) { | 379 : io_data_(io_data) { |
369 DCHECK(io_data); | 380 DCHECK(io_data); |
370 } | 381 } |
371 | 382 |
372 ProfileIOData::ResourceContext::~ResourceContext() {} | 383 ProfileIOData::ResourceContext::~ResourceContext() {} |
373 | 384 |
374 void ProfileIOData::ResourceContext::EnsureInitialized() const { | 385 void ProfileIOData::ResourceContext::EnsureInitialized() const { |
375 io_data_->LazyInitialize(); | 386 io_data_->LazyInitialize(); |
376 } | 387 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 #endif // defined(OS_CHROMEOS) | 469 #endif // defined(OS_CHROMEOS) |
459 | 470 |
460 // Take ownership over these parameters. | 471 // Take ownership over these parameters. |
461 database_tracker_ = profile_params_->database_tracker; | 472 database_tracker_ = profile_params_->database_tracker; |
462 appcache_service_ = profile_params_->appcache_service; | 473 appcache_service_ = profile_params_->appcache_service; |
463 blob_storage_context_ = profile_params_->blob_storage_context; | 474 blob_storage_context_ = profile_params_->blob_storage_context; |
464 file_system_context_ = profile_params_->file_system_context; | 475 file_system_context_ = profile_params_->file_system_context; |
465 quota_manager_ = profile_params_->quota_manager; | 476 quota_manager_ = profile_params_->quota_manager; |
466 host_zoom_map_ = profile_params_->host_zoom_map; | 477 host_zoom_map_ = profile_params_->host_zoom_map; |
467 host_content_settings_map_ = profile_params_->host_content_settings_map; | 478 host_content_settings_map_ = profile_params_->host_content_settings_map; |
| 479 notification_service_ = profile_params_->notification_service; |
468 extension_info_map_ = profile_params_->extension_info_map; | 480 extension_info_map_ = profile_params_->extension_info_map; |
469 prerender_manager_ = profile_params_->prerender_manager; | 481 prerender_manager_ = profile_params_->prerender_manager; |
470 | 482 |
471 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); | 483 resource_context_.set_host_resolver(io_thread_globals->host_resolver.get()); |
472 resource_context_.set_request_context(main_request_context_); | 484 resource_context_.set_request_context(main_request_context_); |
473 resource_context_.set_database_tracker(database_tracker_); | 485 resource_context_.set_database_tracker(database_tracker_); |
474 resource_context_.set_appcache_service(appcache_service_); | 486 resource_context_.set_appcache_service(appcache_service_); |
475 resource_context_.set_blob_storage_context(blob_storage_context_); | 487 resource_context_.set_blob_storage_context(blob_storage_context_); |
476 resource_context_.set_file_system_context(file_system_context_); | 488 resource_context_.set_file_system_context(file_system_context_); |
477 resource_context_.set_quota_manager(quota_manager_); | 489 resource_context_.set_quota_manager(quota_manager_); |
(...skipping 20 matching lines...) Expand all Loading... |
498 context->set_appcache_service(profile_params_->appcache_service); | 510 context->set_appcache_service(profile_params_->appcache_service); |
499 context->set_blob_storage_context(profile_params_->blob_storage_context); | 511 context->set_blob_storage_context(profile_params_->blob_storage_context); |
500 context->set_file_system_context(profile_params_->file_system_context); | 512 context->set_file_system_context(profile_params_->file_system_context); |
501 context->set_extension_info_map(profile_params_->extension_info_map); | 513 context->set_extension_info_map(profile_params_->extension_info_map); |
502 } | 514 } |
503 | 515 |
504 void ProfileIOData::ShutdownOnUIThread() { | 516 void ProfileIOData::ShutdownOnUIThread() { |
505 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 517 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
506 enable_referrers_.Destroy(); | 518 enable_referrers_.Destroy(); |
507 } | 519 } |
OLD | NEW |