| 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::ProtocolHandler> |
| 266 developer_protocol_handler, |
| 267 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 268 chrome_protocol_handler, |
| 269 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 270 chrome_devtools_protocol_handler) { |
| 271 return io_data_.CreateMainRequestContextGetter(blob_protocol_handler.Pass(), |
| 272 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 273 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
| 256 } | 274 } |
| 257 | 275 |
| 258 net::URLRequestContextGetter* | 276 net::URLRequestContextGetter* |
| 259 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( | 277 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( |
| 260 int renderer_child_id) { | 278 int renderer_child_id) { |
| 261 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 279 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 262 renderer_child_id); | 280 renderer_child_id); |
| 263 return rph->GetStoragePartition()->GetURLRequestContext(); | 281 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 264 } | 282 } |
| 265 | 283 |
| 266 net::URLRequestContextGetter* | 284 net::URLRequestContextGetter* |
| 267 OffTheRecordProfileImpl::GetMediaRequestContext() { | 285 OffTheRecordProfileImpl::GetMediaRequestContext() { |
| 268 // In OTR mode, media request context is the same as the original one. | 286 // In OTR mode, media request context is the same as the original one. |
| 269 return GetRequestContext(); | 287 return GetRequestContext(); |
| 270 } | 288 } |
| 271 | 289 |
| 272 net::URLRequestContextGetter* | 290 net::URLRequestContextGetter* |
| 273 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( | 291 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( |
| 274 int renderer_child_id) { | 292 int renderer_child_id) { |
| 275 // In OTR mode, media request context is the same as the original one. | 293 // In OTR mode, media request context is the same as the original one. |
| 276 return GetRequestContextForRenderProcess(renderer_child_id); | 294 return GetRequestContextForRenderProcess(renderer_child_id); |
| 277 } | 295 } |
| 278 | 296 |
| 279 net::URLRequestContextGetter* | 297 net::URLRequestContextGetter* |
| 280 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( | 298 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( |
| 281 const FilePath& partition_path, | 299 const FilePath& partition_path, |
| 282 bool in_memory) { | 300 bool in_memory) { |
| 283 return GetRequestContextForStoragePartition(partition_path, in_memory); | 301 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); |
| 284 } | 302 } |
| 285 | 303 |
| 286 net::URLRequestContextGetter* | 304 net::URLRequestContextGetter* |
| 287 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 305 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
| 288 return io_data_.GetExtensionsRequestContextGetter(); | 306 return io_data_.GetExtensionsRequestContextGetter(); |
| 289 } | 307 } |
| 290 | 308 |
| 291 net::URLRequestContextGetter* | 309 net::URLRequestContextGetter* |
| 292 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( | 310 OffTheRecordProfileImpl::CreateRequestContextForStoragePartition( |
| 293 const FilePath& partition_path, | 311 const FilePath& partition_path, |
| 294 bool in_memory) { | 312 bool in_memory, |
| 295 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 313 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 314 blob_protocol_handler, |
| 315 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 316 file_system_protocol_handler, |
| 317 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 318 developer_protocol_handler, |
| 319 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 320 chrome_protocol_handler, |
| 321 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 322 chrome_devtools_protocol_handler) { |
| 323 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 324 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 325 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 326 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
| 296 } | 327 } |
| 297 | 328 |
| 298 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 329 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
| 299 return io_data_.GetResourceContext(); | 330 return io_data_.GetResourceContext(); |
| 300 } | 331 } |
| 301 | 332 |
| 302 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 333 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
| 303 return profile_->GetSSLConfigService(); | 334 return profile_->GetSSLConfigService(); |
| 304 } | 335 } |
| 305 | 336 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 OffTheRecordProfileImpl* profile = NULL; | 500 OffTheRecordProfileImpl* profile = NULL; |
| 470 #if defined(OS_CHROMEOS) | 501 #if defined(OS_CHROMEOS) |
| 471 if (IsGuestSession()) | 502 if (IsGuestSession()) |
| 472 profile = new GuestSessionProfile(this); | 503 profile = new GuestSessionProfile(this); |
| 473 #endif | 504 #endif |
| 474 if (!profile) | 505 if (!profile) |
| 475 profile = new OffTheRecordProfileImpl(this); | 506 profile = new OffTheRecordProfileImpl(this); |
| 476 profile->Init(); | 507 profile->Init(); |
| 477 return profile; | 508 return profile; |
| 478 } | 509 } |
| OLD | NEW |