| 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 return io_data_.GetMainRequestContextGetter(); | 245 return io_data_.GetMainRequestContextGetter(); |
| 246 } | 246 } |
| 247 | 247 |
| 248 net::URLRequestContextGetter* | 248 net::URLRequestContextGetter* |
| 249 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( | 249 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( |
| 250 int renderer_child_id) { | 250 int renderer_child_id) { |
| 251 if (GetExtensionService()) { | 251 if (GetExtensionService()) { |
| 252 const extensions::Extension* installed_app = GetExtensionService()-> | 252 const extensions::Extension* installed_app = GetExtensionService()-> |
| 253 GetInstalledAppForRenderer(renderer_child_id); | 253 GetInstalledAppForRenderer(renderer_child_id); |
| 254 if (installed_app != NULL && installed_app->is_storage_isolated()) { | 254 if (installed_app != NULL && installed_app->is_storage_isolated()) { |
| 255 return GetRequestContextForIsolatedApp(installed_app->id()); | 255 return GetRequestContextForStoragePartition(installed_app->id()); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 | 258 |
| 259 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 259 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 260 renderer_child_id); | 260 renderer_child_id); |
| 261 if (rph && rph->IsGuest()) { | 261 if (rph && rph->IsGuest()) { |
| 262 // For guest processes (used by the browser tag), we need to isolate the | 262 // For guest processes (used by the browser tag), we need to isolate the |
| 263 // storage. | 263 // storage. |
| 264 // TODO(nasko): Until we have proper storage partitions, create a | 264 // TODO(nasko): Until we have proper storage partitions, create a |
| 265 // non-persistent context using the RPH's id. | 265 // non-persistent context using the RPH's id. |
| 266 std::string id("guest-"); | 266 std::string id("guest-"); |
| 267 id.append(base::IntToString(renderer_child_id)); | 267 id.append(base::IntToString(renderer_child_id)); |
| 268 return GetRequestContextForIsolatedApp(id); | 268 return GetRequestContextForStoragePartition(id); |
| 269 } | 269 } |
| 270 | 270 |
| 271 return GetRequestContext(); | 271 return GetRequestContext(); |
| 272 } | 272 } |
| 273 | 273 |
| 274 net::URLRequestContextGetter* | 274 net::URLRequestContextGetter* |
| 275 OffTheRecordProfileImpl::GetMediaRequestContext() { | 275 OffTheRecordProfileImpl::GetMediaRequestContext() { |
| 276 // In OTR mode, media request context is the same as the original one. | 276 // In OTR mode, media request context is the same as the original one. |
| 277 return GetRequestContext(); | 277 return GetRequestContext(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 net::URLRequestContextGetter* | 280 net::URLRequestContextGetter* |
| 281 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( | 281 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( |
| 282 int renderer_child_id) { | 282 int renderer_child_id) { |
| 283 // In OTR mode, media request context is the same as the original one. | 283 // In OTR mode, media request context is the same as the original one. |
| 284 return GetRequestContextForRenderProcess(renderer_child_id); | 284 return GetRequestContextForRenderProcess(renderer_child_id); |
| 285 } | 285 } |
| 286 | 286 |
| 287 net::URLRequestContextGetter* | 287 net::URLRequestContextGetter* |
| 288 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( |
| 289 const std::string& partition_id) { |
| 290 return GetRequestContextForStoragePartition(partition_id); |
| 291 } |
| 292 |
| 293 net::URLRequestContextGetter* |
| 288 OffTheRecordProfileImpl::GetRequestContextForExtensions() { | 294 OffTheRecordProfileImpl::GetRequestContextForExtensions() { |
| 289 return io_data_.GetExtensionsRequestContextGetter(); | 295 return io_data_.GetExtensionsRequestContextGetter(); |
| 290 } | 296 } |
| 291 | 297 |
| 292 net::URLRequestContextGetter* | 298 net::URLRequestContextGetter* |
| 293 OffTheRecordProfileImpl::GetRequestContextForIsolatedApp( | 299 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( |
| 294 const std::string& app_id) { | 300 const std::string& partition_id) { |
| 295 return io_data_.GetIsolatedAppRequestContextGetter(app_id); | 301 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); |
| 296 } | 302 } |
| 297 | 303 |
| 298 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { | 304 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { |
| 299 return io_data_.GetResourceContext(); | 305 return io_data_.GetResourceContext(); |
| 300 } | 306 } |
| 301 | 307 |
| 302 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { | 308 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { |
| 303 return profile_->GetSSLConfigService(); | 309 return profile_->GetSSLConfigService(); |
| 304 } | 310 } |
| 305 | 311 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 if (!profile) | 476 if (!profile) |
| 471 profile = new OffTheRecordProfileImpl(this); | 477 profile = new OffTheRecordProfileImpl(this); |
| 472 profile->Init(); | 478 profile->Init(); |
| 473 return profile; | 479 return profile; |
| 474 } | 480 } |
| 475 | 481 |
| 476 base::Callback<ChromeURLDataManagerBackend*(void)> | 482 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 477 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 483 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 478 return io_data_.GetChromeURLDataManagerBackendGetter(); | 484 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 479 } | 485 } |
| OLD | NEW |