| 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_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 profile_, io_data_); | 204 profile_, io_data_); |
| 205 } | 205 } |
| 206 return extensions_request_context_getter_; | 206 return extensions_request_context_getter_; |
| 207 } | 207 } |
| 208 | 208 |
| 209 scoped_refptr<ChromeURLRequestContextGetter> | 209 scoped_refptr<ChromeURLRequestContextGetter> |
| 210 ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter( | 210 ProfileImplIOData::Handle::GetIsolatedAppRequestContextGetter( |
| 211 const FilePath& partition_path, | 211 const FilePath& partition_path, |
| 212 bool in_memory) const { | 212 bool in_memory) const { |
| 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 214 // TODO(nasko): Check that the partition_path is not the same as the | 214 // Check that the partition_path is not the same as the base profile path. We |
| 215 // base profile path. We expect isolated partition, which will never go | 215 // expect isolated partition, which will never go to the default profile path. |
| 216 // to the default profile path. | 216 CHECK(partition_path != profile_->GetPath()); |
| 217 LazyInitialize(); | 217 LazyInitialize(); |
| 218 | 218 |
| 219 // Keep a map of request context getters, one per requested storage partition. | 219 // Keep a map of request context getters, one per requested storage partition. |
| 220 StoragePartitionDescriptor descriptor(partition_path, in_memory); | 220 StoragePartitionDescriptor descriptor(partition_path, in_memory); |
| 221 ChromeURLRequestContextGetterMap::iterator iter = | 221 ChromeURLRequestContextGetterMap::iterator iter = |
| 222 app_request_context_getter_map_.find(descriptor); | 222 app_request_context_getter_map_.find(descriptor); |
| 223 if (iter != app_request_context_getter_map_.end()) | 223 if (iter != app_request_context_getter_map_.end()) |
| 224 return iter->second; | 224 return iter->second; |
| 225 | 225 |
| 226 scoped_ptr<net::URLRequestJobFactory::Interceptor> | 226 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 227 protocol_handler_interceptor( | 227 protocol_handler_interceptor( |
| 228 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> | 228 ProtocolHandlerRegistryFactory::GetForProfile(profile_)-> |
| 229 CreateURLInterceptor()); | 229 CreateURLInterceptor()); |
| 230 ChromeURLRequestContextGetter* context = | 230 ChromeURLRequestContextGetter* context = |
| 231 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( | 231 ChromeURLRequestContextGetter::CreateOriginalForIsolatedApp( |
| 232 profile_, io_data_, descriptor, | 232 profile_, io_data_, descriptor, |
| 233 protocol_handler_interceptor.Pass()); | 233 protocol_handler_interceptor.Pass()); |
| 234 app_request_context_getter_map_[descriptor] = context; | 234 app_request_context_getter_map_[descriptor] = context; |
| 235 | 235 |
| 236 return context; | 236 return context; |
| 237 } | 237 } |
| 238 | 238 |
| 239 scoped_refptr<ChromeURLRequestContextGetter> | 239 scoped_refptr<ChromeURLRequestContextGetter> |
| 240 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( | 240 ProfileImplIOData::Handle::GetIsolatedMediaRequestContextGetter( |
| 241 const FilePath& partition_path, | 241 const FilePath& partition_path, |
| 242 bool in_memory) const { | 242 bool in_memory) const { |
| 243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 244 // We must have a non-default path, or this will act like the default media | 244 // We must have a non-default path, or this will act like the default media |
| 245 // context. | 245 // context. |
| 246 // | 246 CHECK(partition_path != profile_->GetPath()); |
| 247 // TODO(nasko): Check that the partition_path is not the same as the | |
| 248 // base profile path. We expect isolated partition, which will never go | |
| 249 // to the default profile path. | |
| 250 LazyInitialize(); | 247 LazyInitialize(); |
| 251 | 248 |
| 252 // Keep a map of request context getters, one per requested storage partition. | 249 // Keep a map of request context getters, one per requested storage partition. |
| 253 StoragePartitionDescriptor descriptor(partition_path, in_memory); | 250 StoragePartitionDescriptor descriptor(partition_path, in_memory); |
| 254 ChromeURLRequestContextGetterMap::iterator iter = | 251 ChromeURLRequestContextGetterMap::iterator iter = |
| 255 isolated_media_request_context_getter_map_.find(descriptor); | 252 isolated_media_request_context_getter_map_.find(descriptor); |
| 256 if (iter != isolated_media_request_context_getter_map_.end()) | 253 if (iter != isolated_media_request_context_getter_map_.end()) |
| 257 return iter->second; | 254 return iter->second; |
| 258 | 255 |
| 259 // Get the app context as the starting point for the media context, so that | 256 // Get the app context as the starting point for the media context, so that |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 base::Time time, | 679 base::Time time, |
| 683 const base::Closure& completion) { | 680 const base::Closure& completion) { |
| 684 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 681 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 685 LazyInitialize(); | 682 LazyInitialize(); |
| 686 | 683 |
| 687 DCHECK(transport_security_state()); | 684 DCHECK(transport_security_state()); |
| 688 transport_security_state()->DeleteSince(time); // Completes synchronously. | 685 transport_security_state()->DeleteSince(time); // Completes synchronously. |
| 689 DCHECK(http_server_properties_manager()); | 686 DCHECK(http_server_properties_manager()); |
| 690 http_server_properties_manager()->Clear(completion); | 687 http_server_properties_manager()->Clear(completion); |
| 691 } | 688 } |
| OLD | NEW |