Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed macro and InMemory. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/extensions/extension.h" 43 #include "chrome/common/extensions/extension.h"
44 #include "chrome/common/json_pref_store.h" 44 #include "chrome/common/json_pref_store.h"
45 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
46 #include "chrome/common/render_messages.h" 46 #include "chrome/common/render_messages.h"
47 #include "content/public/browser/browser_thread.h" 47 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/host_zoom_map.h" 48 #include "content/public/browser/host_zoom_map.h"
49 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/notification_types.h" 50 #include "content/public/browser/notification_types.h"
51 #include "content/public/browser/render_process_host.h" 51 #include "content/public/browser/render_process_host.h"
52 #include "content/public/browser/storage_partition.h"
52 #include "content/public/browser/web_contents.h" 53 #include "content/public/browser/web_contents.h"
53 #include "net/base/transport_security_state.h" 54 #include "net/base/transport_security_state.h"
54 #include "net/http/http_server_properties.h" 55 #include "net/http/http_server_properties.h"
55 #include "webkit/database/database_tracker.h" 56 #include "webkit/database/database_tracker.h"
56 57
57 #if defined(OS_ANDROID) 58 #if defined(OS_ANDROID)
58 #include "chrome/browser/prefs/scoped_user_pref_update.h" 59 #include "chrome/browser/prefs/scoped_user_pref_update.h"
59 #endif 60 #endif
60 61
61 #if defined(OS_CHROMEOS) 62 #if defined(OS_CHROMEOS)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 GetDownloadManagerDelegate(); 271 GetDownloadManagerDelegate();
271 } 272 }
272 273
273 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { 274 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
274 return io_data_.GetMainRequestContextGetter(); 275 return io_data_.GetMainRequestContextGetter();
275 } 276 }
276 277
277 net::URLRequestContextGetter* 278 net::URLRequestContextGetter*
278 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( 279 OffTheRecordProfileImpl::GetRequestContextForRenderProcess(
279 int renderer_child_id) { 280 int renderer_child_id) {
280 ExtensionService* extension_service =
281 extensions::ExtensionSystem::Get(this)->extension_service();
282 if (extension_service) {
283 const extensions::Extension* extension =
284 extension_service->GetIsolatedAppForRenderer(renderer_child_id);
285 if (extension)
286 return GetRequestContextForStoragePartition(extension->id());
287 }
288
289 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 281 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
290 renderer_child_id); 282 renderer_child_id);
291 if (rph && rph->IsGuest()) { 283 CHECK(rph);
awong 2012/10/19 23:26:50 unnecessary CHECK(). The next line will crash due
nasko 2012/10/19 23:55:16 Done.
292 // For guest processes (used by the browser tag), we need to isolate the 284 return rph->GetStoragePartition()->GetURLRequestContext();
293 // storage.
294 // TODO(nasko): Until we have proper storage partitions, create a
295 // non-persistent context using the RPH's id.
296 std::string id("guest-");
297 id.append(base::IntToString(renderer_child_id));
298 return GetRequestContextForStoragePartition(id);
299 }
300
301 return GetRequestContext();
302 } 285 }
303 286
304 net::URLRequestContextGetter* 287 net::URLRequestContextGetter*
305 OffTheRecordProfileImpl::GetMediaRequestContext() { 288 OffTheRecordProfileImpl::GetMediaRequestContext() {
306 // In OTR mode, media request context is the same as the original one. 289 // In OTR mode, media request context is the same as the original one.
307 return GetRequestContext(); 290 return GetRequestContext();
308 } 291 }
309 292
310 net::URLRequestContextGetter* 293 net::URLRequestContextGetter*
311 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( 294 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess(
312 int renderer_child_id) { 295 int renderer_child_id) {
313 // In OTR mode, media request context is the same as the original one. 296 // In OTR mode, media request context is the same as the original one.
314 return GetRequestContextForRenderProcess(renderer_child_id); 297 return GetRequestContextForRenderProcess(renderer_child_id);
315 } 298 }
316 299
317 net::URLRequestContextGetter* 300 net::URLRequestContextGetter*
318 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( 301 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition(
319 const std::string& partition_id) { 302 const FilePath& partition_path,
320 return GetRequestContextForStoragePartition(partition_id); 303 bool in_memory) {
304 return GetRequestContextForStoragePartition(partition_path, in_memory);
321 } 305 }
322 306
323 net::URLRequestContextGetter* 307 net::URLRequestContextGetter*
324 OffTheRecordProfileImpl::GetRequestContextForExtensions() { 308 OffTheRecordProfileImpl::GetRequestContextForExtensions() {
325 return io_data_.GetExtensionsRequestContextGetter(); 309 return io_data_.GetExtensionsRequestContextGetter();
326 } 310 }
327 311
328 net::URLRequestContextGetter* 312 net::URLRequestContextGetter*
329 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( 313 OffTheRecordProfileImpl::GetRequestContextForStoragePartition(
330 const std::string& partition_id) { 314 const FilePath& partition_path,
331 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 315 bool in_memory) {
316 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
332 } 317 }
333 318
334 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { 319 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() {
335 return io_data_.GetResourceContext(); 320 return io_data_.GetResourceContext();
336 } 321 }
337 322
338 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { 323 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() {
339 return profile_->GetSSLConfigService(); 324 return profile_->GetSSLConfigService();
340 } 325 }
341 326
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (!profile) 491 if (!profile)
507 profile = new OffTheRecordProfileImpl(this); 492 profile = new OffTheRecordProfileImpl(this);
508 profile->Init(); 493 profile->Init();
509 return profile; 494 return profile;
510 } 495 }
511 496
512 base::Callback<ChromeURLDataManagerBackend*(void)> 497 base::Callback<ChromeURLDataManagerBackend*(void)>
513 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { 498 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const {
514 return io_data_.GetChromeURLDataManagerBackendGetter(); 499 return io_data_.GetChromeURLDataManagerBackendGetter();
515 } 500 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698