| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/content_settings/cookie_settings.h" | 20 #include "chrome/browser/content_settings/cookie_settings.h" |
| 21 #include "chrome/browser/content_settings/host_content_settings_map.h" | 21 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 22 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 22 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 23 #include "chrome/browser/download/download_service.h" | 23 #include "chrome/browser/download/download_service.h" |
| 24 #include "chrome/browser/download/download_service_factory.h" | 24 #include "chrome/browser/download/download_service_factory.h" |
| 25 #include "chrome/browser/extensions/extension_info_map.h" | 25 #include "chrome/browser/extensions/extension_info_map.h" |
| 26 #include "chrome/browser/extensions/extension_protocols.h" | 26 #include "chrome/browser/extensions/extension_protocols.h" |
| 27 #include "chrome/browser/io_thread.h" | 27 #include "chrome/browser/io_thread.h" |
| 28 #include "chrome/browser/media/media_internals.h" | |
| 29 #include "chrome/browser/net/chrome_cookie_notification_details.h" | 28 #include "chrome/browser/net/chrome_cookie_notification_details.h" |
| 30 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" | 29 #include "chrome/browser/net/chrome_fraudulent_certificate_reporter.h" |
| 31 #include "chrome/browser/net/chrome_net_log.h" | 30 #include "chrome/browser/net/chrome_net_log.h" |
| 32 #include "chrome/browser/net/chrome_network_delegate.h" | 31 #include "chrome/browser/net/chrome_network_delegate.h" |
| 33 #include "chrome/browser/net/proxy_service_factory.h" | 32 #include "chrome/browser/net/proxy_service_factory.h" |
| 34 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 33 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 35 #include "chrome/browser/policy/url_blacklist_manager.h" | 34 #include "chrome/browser/policy/url_blacklist_manager.h" |
| 36 #include "chrome/browser/prefs/pref_service.h" | 35 #include "chrome/browser/prefs/pref_service.h" |
| 37 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 38 #include "chrome/browser/profiles/profile_manager.h" | 37 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 EnsureInitialized(); | 383 EnsureInitialized(); |
| 385 return host_resolver_; | 384 return host_resolver_; |
| 386 } | 385 } |
| 387 | 386 |
| 388 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { | 387 net::URLRequestContext* ProfileIOData::ResourceContext::GetRequestContext() { |
| 389 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 388 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 390 EnsureInitialized(); | 389 EnsureInitialized(); |
| 391 return request_context_; | 390 return request_context_; |
| 392 } | 391 } |
| 393 | 392 |
| 394 content::MediaObserver* ProfileIOData::ResourceContext::GetMediaObserver() { | |
| 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 396 EnsureInitialized(); | |
| 397 return media_observer_; | |
| 398 } | |
| 399 | |
| 400 // static | 393 // static |
| 401 std::string ProfileIOData::GetSSLSessionCacheShard() { | 394 std::string ProfileIOData::GetSSLSessionCacheShard() { |
| 402 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 395 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 403 // The SSL session cache is partitioned by setting a string. This returns a | 396 // The SSL session cache is partitioned by setting a string. This returns a |
| 404 // unique string to partition the SSL session cache. Each time we create a | 397 // unique string to partition the SSL session cache. Each time we create a |
| 405 // new profile, we'll get a fresh SSL session cache which is separate from | 398 // new profile, we'll get a fresh SSL session cache which is separate from |
| 406 // the other profiles. | 399 // the other profiles. |
| 407 static unsigned ssl_session_cache_instance = 0; | 400 static unsigned ssl_session_cache_instance = 0; |
| 408 return StringPrintf("profile/%u", ssl_session_cache_instance++); | 401 return StringPrintf("profile/%u", ssl_session_cache_instance++); |
| 409 } | 402 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // Take ownership over these parameters. | 481 // Take ownership over these parameters. |
| 489 host_content_settings_map_ = profile_params_->host_content_settings_map; | 482 host_content_settings_map_ = profile_params_->host_content_settings_map; |
| 490 cookie_settings_ = profile_params_->cookie_settings; | 483 cookie_settings_ = profile_params_->cookie_settings; |
| 491 #if defined(ENABLE_NOTIFICATIONS) | 484 #if defined(ENABLE_NOTIFICATIONS) |
| 492 notification_service_ = profile_params_->notification_service; | 485 notification_service_ = profile_params_->notification_service; |
| 493 #endif | 486 #endif |
| 494 extension_info_map_ = profile_params_->extension_info_map; | 487 extension_info_map_ = profile_params_->extension_info_map; |
| 495 | 488 |
| 496 resource_context_.host_resolver_ = io_thread_globals->host_resolver.get(); | 489 resource_context_.host_resolver_ = io_thread_globals->host_resolver.get(); |
| 497 resource_context_.request_context_ = main_request_context_; | 490 resource_context_.request_context_ = main_request_context_; |
| 498 resource_context_.media_observer_ = | |
| 499 io_thread_globals->media.media_internals.get(); | |
| 500 | 491 |
| 501 LazyInitializeInternal(profile_params_.get()); | 492 LazyInitializeInternal(profile_params_.get()); |
| 502 | 493 |
| 503 profile_params_.reset(); | 494 profile_params_.reset(); |
| 504 initialized_ = true; | 495 initialized_ = true; |
| 505 } | 496 } |
| 506 | 497 |
| 507 void ProfileIOData::ApplyProfileParamsToContext( | 498 void ProfileIOData::ApplyProfileParamsToContext( |
| 508 ChromeURLRequestContext* context) const { | 499 ChromeURLRequestContext* context) const { |
| 509 context->set_is_incognito(profile_params_->is_incognito); | 500 context->set_is_incognito(profile_params_->is_incognito); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 531 &resource_context_)); | 522 &resource_context_)); |
| 532 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 523 bool posted = BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
| 533 if (!posted) | 524 if (!posted) |
| 534 delete this; | 525 delete this; |
| 535 } | 526 } |
| 536 | 527 |
| 537 void ProfileIOData::set_server_bound_cert_service( | 528 void ProfileIOData::set_server_bound_cert_service( |
| 538 net::ServerBoundCertService* server_bound_cert_service) const { | 529 net::ServerBoundCertService* server_bound_cert_service) const { |
| 539 server_bound_cert_service_.reset(server_bound_cert_service); | 530 server_bound_cert_service_.reset(server_bound_cert_service); |
| 540 } | 531 } |
| OLD | NEW |