| 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_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (extensions_request_context_getter_) | 41 if (extensions_request_context_getter_) |
| 42 extensions_request_context_getter_->CleanupOnUIThread(); | 42 extensions_request_context_getter_->CleanupOnUIThread(); |
| 43 | 43 |
| 44 // Clean up all isolated app request contexts. | 44 // Clean up all isolated app request contexts. |
| 45 for (ChromeURLRequestContextGetterMap::iterator iter = | 45 for (ChromeURLRequestContextGetterMap::iterator iter = |
| 46 app_request_context_getter_map_.begin(); | 46 app_request_context_getter_map_.begin(); |
| 47 iter != app_request_context_getter_map_.end(); | 47 iter != app_request_context_getter_map_.end(); |
| 48 ++iter) { | 48 ++iter) { |
| 49 iter->second->CleanupOnUIThread(); | 49 iter->second->CleanupOnUIThread(); |
| 50 } | 50 } |
| 51 |
| 52 io_data_->ShutdownOnUIThread(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void ProfileImplIOData::Handle::Init(const FilePath& cookie_path, | 55 void ProfileImplIOData::Handle::Init(const FilePath& cookie_path, |
| 54 const FilePath& cache_path, | 56 const FilePath& cache_path, |
| 55 int cache_max_size, | 57 int cache_max_size, |
| 56 const FilePath& media_cache_path, | 58 const FilePath& media_cache_path, |
| 57 int media_cache_max_size, | 59 int media_cache_max_size, |
| 58 const FilePath& extensions_cookie_path, | 60 const FilePath& extensions_cookie_path, |
| 59 const FilePath& app_path) { | 61 const FilePath& app_path) { |
| 60 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 134 |
| 133 return context; | 135 return context; |
| 134 } | 136 } |
| 135 | 137 |
| 136 void ProfileImplIOData::Handle::LazyInitialize() const { | 138 void ProfileImplIOData::Handle::LazyInitialize() const { |
| 137 if (!initialized_) { | 139 if (!initialized_) { |
| 138 InitializeProfileParams(profile_, &io_data_->lazy_params_->profile_params); | 140 InitializeProfileParams(profile_, &io_data_->lazy_params_->profile_params); |
| 139 // Keep track of clear_local_state_on_exit for isolated apps. | 141 // Keep track of clear_local_state_on_exit for isolated apps. |
| 140 io_data_->clear_local_state_on_exit_ = | 142 io_data_->clear_local_state_on_exit_ = |
| 141 io_data_->lazy_params_->profile_params.clear_local_state_on_exit; | 143 io_data_->lazy_params_->profile_params.clear_local_state_on_exit; |
| 144 ChromeNetworkDelegate::InitializeReferrersEnabled( |
| 145 io_data_->enable_referrers(), profile_->GetPrefs()); |
| 142 initialized_ = true; | 146 initialized_ = true; |
| 143 } | 147 } |
| 144 } | 148 } |
| 145 | 149 |
| 146 ProfileImplIOData::LazyParams::LazyParams() | 150 ProfileImplIOData::LazyParams::LazyParams() |
| 147 : cache_max_size(0), | 151 : cache_max_size(0), |
| 148 media_cache_max_size(0), | 152 media_cache_max_size(0), |
| 149 io_thread(NULL) {} | 153 io_thread(NULL) {} |
| 150 ProfileImplIOData::LazyParams::~LazyParams() {} | 154 ProfileImplIOData::LazyParams::~LazyParams() {} |
| 151 | 155 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 182 media_request_context_->set_cookie_policy(cookie_policy_.get()); | 186 media_request_context_->set_cookie_policy(cookie_policy_.get()); |
| 183 extensions_request_context_->set_cookie_policy(cookie_policy_.get()); | 187 extensions_request_context_->set_cookie_policy(cookie_policy_.get()); |
| 184 | 188 |
| 185 main_request_context_->set_net_log(lazy_params_->io_thread->net_log()); | 189 main_request_context_->set_net_log(lazy_params_->io_thread->net_log()); |
| 186 media_request_context_->set_net_log(lazy_params_->io_thread->net_log()); | 190 media_request_context_->set_net_log(lazy_params_->io_thread->net_log()); |
| 187 extensions_request_context_->set_net_log(lazy_params_->io_thread->net_log()); | 191 extensions_request_context_->set_net_log(lazy_params_->io_thread->net_log()); |
| 188 | 192 |
| 189 network_delegate_.reset(new ChromeNetworkDelegate( | 193 network_delegate_.reset(new ChromeNetworkDelegate( |
| 190 io_thread_globals->extension_event_router_forwarder.get(), | 194 io_thread_globals->extension_event_router_forwarder.get(), |
| 191 profile_params.profile_id, | 195 profile_params.profile_id, |
| 196 enable_referrers(), |
| 192 profile_params.protocol_handler_registry)); | 197 profile_params.protocol_handler_registry)); |
| 193 main_request_context_->set_network_delegate(network_delegate_.get()); | 198 main_request_context_->set_network_delegate(network_delegate_.get()); |
| 194 media_request_context_->set_network_delegate(network_delegate_.get()); | 199 media_request_context_->set_network_delegate(network_delegate_.get()); |
| 195 | 200 |
| 196 main_request_context_->set_host_resolver( | 201 main_request_context_->set_host_resolver( |
| 197 io_thread_globals->host_resolver.get()); | 202 io_thread_globals->host_resolver.get()); |
| 198 media_request_context_->set_host_resolver( | 203 media_request_context_->set_host_resolver( |
| 199 io_thread_globals->host_resolver.get()); | 204 io_thread_globals->host_resolver.get()); |
| 200 main_request_context_->set_cert_verifier( | 205 main_request_context_->set_cert_verifier( |
| 201 io_thread_globals->cert_verifier.get()); | 206 io_thread_globals->cert_verifier.get()); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 ProfileImplIOData::AcquireIsolatedAppRequestContext( | 401 ProfileImplIOData::AcquireIsolatedAppRequestContext( |
| 397 scoped_refptr<ChromeURLRequestContext> main_context, | 402 scoped_refptr<ChromeURLRequestContext> main_context, |
| 398 const std::string& app_id) const { | 403 const std::string& app_id) const { |
| 399 // We create per-app contexts on demand, unlike the others above. | 404 // We create per-app contexts on demand, unlike the others above. |
| 400 scoped_refptr<RequestContext> app_request_context = | 405 scoped_refptr<RequestContext> app_request_context = |
| 401 InitializeAppRequestContext(main_context, app_id); | 406 InitializeAppRequestContext(main_context, app_id); |
| 402 DCHECK(app_request_context); | 407 DCHECK(app_request_context); |
| 403 app_request_context->set_profile_io_data(this); | 408 app_request_context->set_profile_io_data(this); |
| 404 return app_request_context; | 409 return app_request_context; |
| 405 } | 410 } |
| OLD | NEW |