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