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/off_the_record_profile_impl.h" | 5 #include "chrome/browser/profiles/off_the_record_profile_impl.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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 PrefServiceSyncable* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { | 245 PrefServiceSyncable* OffTheRecordProfileImpl::GetOffTheRecordPrefs() { |
246 return prefs_; | 246 return prefs_; |
247 } | 247 } |
248 | 248 |
249 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { | 249 DownloadManagerDelegate* OffTheRecordProfileImpl::GetDownloadManagerDelegate() { |
250 return DownloadServiceFactory::GetForProfile(this)-> | 250 return DownloadServiceFactory::GetForProfile(this)-> |
251 GetDownloadManagerDelegate(); | 251 GetDownloadManagerDelegate(); |
252 } | 252 } |
253 | 253 |
254 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { | 254 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { |
255 return io_data_.GetMainRequestContextGetter(); | 255 content::StoragePartition* storage_partition = |
| 256 BrowserContext::GetStoragePartition(this, NULL); |
| 257 return storage_partition->GetURLRequestContext(); |
| 258 } |
| 259 |
| 260 net::URLRequestContextGetter* OffTheRecordProfileImpl::CreateRequestContext( |
| 261 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 262 blob_protocol_handler, |
| 263 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 264 file_system_protocol_handler, |
| 265 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 266 developer_protocol_handler) { |
| 267 return io_data_.CreateMainRequestContextGetter(blob_protocol_handler.Pass(), |
| 268 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); |
256 } | 269 } |
257 | 270 |
258 net::URLRequestContextGetter* | 271 net::URLRequestContextGetter* |
259 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( | 272 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( |
260 int renderer_child_id) { | 273 int renderer_child_id) { |
261 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 274 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
262 renderer_child_id); | 275 renderer_child_id); |
263 return rph->GetStoragePartition()->GetURLRequestContext(); | 276 return rph->GetStoragePartition()->GetURLRequestContext(); |
264 } | 277 } |
265 | 278 |
266 net::URLRequestContextGetter* | 279 net::URLRequestContextGetter* |
267 OffTheRecordProfileImpl::GetMediaRequestContext() { | 280 OffTheRecordProfileImpl::GetMediaRequestContext() { |
268 // In OTR mode, media request context is the same as the original one. | 281 // In OTR mode, media request context is the same as the original one. |
269 return GetRequestContext(); | 282 return GetRequestContext(); |
270 } | 283 } |
271 | 284 |
272 net::URLRequestContextGetter* | 285 net::URLRequestContextGetter* |
273 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( | 286 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( |
274 int renderer_child_id) { | 287 int renderer_child_id) { |
275 // In OTR mode, media request context is the same as the original one. | 288 // In OTR mode, media request context is the same as the original one. |
276 return GetRequestContextForRenderProcess(renderer_child_id); | 289 return GetRequestContextForRenderProcess(renderer_child_id); |
277 } | 290 } |
278 | 291 |
279 net::URLRequestContextGetter* | 292 net::URLRequestContextGetter* |
280 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( | 293 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( |
281 const FilePath& partition_path, | 294 const FilePath& partition_path, |
282 bool in_memory) { | 295 bool in_memory) { |
283 return GetRequestContextForStoragePartition(partition_path, in_memory); | 296 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); |
284 } | 297 } |
285 | 298 |
286 net::URLRequestContextGetter* | 299 net::URLRequestContextGetter* |
287 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 300 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
288 return io_data_.GetExtensionsRequestContextGetter(); | 301 return io_data_.GetExtensionsRequestContextGetter(); |
289 } | 302 } |
290 | 303 |
291 net::URLRequestContextGetter* | 304 net::URLRequestContextGetter* |
292 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( | 305 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( |
293 const FilePath& partition_path, | 306 const FilePath& partition_path, |
294 bool in_memory) { | 307 bool in_memory, |
295 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 308 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 309 blob_protocol_handler, |
| 310 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 311 file_system_protocol_handler, |
| 312 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 313 developer_protocol_handler) { |
| 314 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 315 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 316 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); |
296 } | 317 } |
297 | 318 |
298 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 319 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
299 return io_data_.GetResourceContext(); | 320 return io_data_.GetResourceContext(); |
300 } | 321 } |
301 | 322 |
302 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 323 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
303 return profile_->GetSSLConfigService(); | 324 return profile_->GetSSLConfigService(); |
304 } | 325 } |
305 | 326 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (!profile) | 495 if (!profile) |
475 profile = new OffTheRecordProfileImpl(this); | 496 profile = new OffTheRecordProfileImpl(this); |
476 profile->Init(); | 497 profile->Init(); |
477 return profile; | 498 return profile; |
478 } | 499 } |
479 | 500 |
480 base::Callback<ChromeURLDataManagerBackend*(void)> | 501 base::Callback<ChromeURLDataManagerBackend*(void)> |
481 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 502 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
482 return io_data_.GetChromeURLDataManagerBackendGetter(); | 503 return io_data_.GetChromeURLDataManagerBackendGetter(); |
483 } | 504 } |
OLD | NEW |