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

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: Fixed the order in the gypi file. 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 return rph->GetStoragePartition()->GetURLRequestContext();
292 // For guest processes (used by the browser tag), we need to isolate the
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 } 284 }
303 285
304 net::URLRequestContextGetter* 286 net::URLRequestContextGetter*
305 OffTheRecordProfileImpl::GetMediaRequestContext() { 287 OffTheRecordProfileImpl::GetMediaRequestContext() {
306 // 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.
307 return GetRequestContext(); 289 return GetRequestContext();
308 } 290 }
309 291
310 net::URLRequestContextGetter* 292 net::URLRequestContextGetter*
311 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( 293 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess(
312 int renderer_child_id) { 294 int renderer_child_id) {
313 // In OTR mode, media request context is the same as the original one. 295 // In OTR mode, media request context is the same as the original one.
314 return GetRequestContextForRenderProcess(renderer_child_id); 296 return GetRequestContextForRenderProcess(renderer_child_id);
315 } 297 }
316 298
317 net::URLRequestContextGetter* 299 net::URLRequestContextGetter*
318 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( 300 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition(
319 const std::string& partition_id) { 301 const FilePath& partition_path,
320 return GetRequestContextForStoragePartition(partition_id); 302 bool in_memory) {
303 return GetRequestContextForStoragePartition(partition_path, in_memory);
321 } 304 }
322 305
323 net::URLRequestContextGetter* 306 net::URLRequestContextGetter*
324 OffTheRecordProfileImpl::GetRequestContextForExtensions() { 307 OffTheRecordProfileImpl::GetRequestContextForExtensions() {
325 return io_data_.GetExtensionsRequestContextGetter(); 308 return io_data_.GetExtensionsRequestContextGetter();
326 } 309 }
327 310
328 net::URLRequestContextGetter* 311 net::URLRequestContextGetter*
329 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( 312 OffTheRecordProfileImpl::GetRequestContextForStoragePartition(
330 const std::string& partition_id) { 313 const FilePath& partition_path,
331 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 314 bool in_memory) {
315 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
332 } 316 }
333 317
334 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { 318 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() {
335 return io_data_.GetResourceContext(); 319 return io_data_.GetResourceContext();
336 } 320 }
337 321
338 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { 322 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() {
339 return profile_->GetSSLConfigService(); 323 return profile_->GetSSLConfigService();
340 } 324 }
341 325
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (!profile) 490 if (!profile)
507 profile = new OffTheRecordProfileImpl(this); 491 profile = new OffTheRecordProfileImpl(this);
508 profile->Init(); 492 profile->Init();
509 return profile; 493 return profile;
510 } 494 }
511 495
512 base::Callback<ChromeURLDataManagerBackend*(void)> 496 base::Callback<ChromeURLDataManagerBackend*(void)>
513 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { 497 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const {
514 return io_data_.GetChromeURLDataManagerBackendGetter(); 498 return io_data_.GetChromeURLDataManagerBackendGetter();
515 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698