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

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: Changing bool param to pass by reference. 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 16 matching lines...) Expand all
27 #include "chrome/browser/extensions/extension_process_manager.h" 27 #include "chrome/browser/extensions/extension_process_manager.h"
28 #include "chrome/browser/extensions/extension_service.h" 28 #include "chrome/browser/extensions/extension_service.h"
29 #include "chrome/browser/extensions/extension_special_storage_policy.h" 29 #include "chrome/browser/extensions/extension_special_storage_policy.h"
30 #include "chrome/browser/extensions/extension_system.h" 30 #include "chrome/browser/extensions/extension_system.h"
31 #include "chrome/browser/io_thread.h" 31 #include "chrome/browser/io_thread.h"
32 #include "chrome/browser/net/proxy_service_factory.h" 32 #include "chrome/browser/net/proxy_service_factory.h"
33 #include "chrome/browser/plugins/plugin_prefs.h" 33 #include "chrome/browser/plugins/plugin_prefs.h"
34 #include "chrome/browser/prefs/incognito_mode_prefs.h" 34 #include "chrome/browser/prefs/incognito_mode_prefs.h"
35 #include "chrome/browser/prefs/pref_service.h" 35 #include "chrome/browser/prefs/pref_service.h"
36 #include "chrome/browser/profiles/profile_dependency_manager.h" 36 #include "chrome/browser/profiles/profile_dependency_manager.h"
37 #include "chrome/browser/storage_partition_details.h"
37 #include "chrome/browser/themes/theme_service.h" 38 #include "chrome/browser/themes/theme_service.h"
38 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" 39 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h"
39 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 40 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
40 #include "chrome/common/chrome_constants.h" 41 #include "chrome/common/chrome_constants.h"
41 #include "chrome/common/chrome_paths.h" 42 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 43 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/extensions/extension.h" 44 #include "chrome/common/extensions/extension.h"
44 #include "chrome/common/json_pref_store.h" 45 #include "chrome/common/json_pref_store.h"
45 #include "chrome/common/pref_names.h" 46 #include "chrome/common/pref_names.h"
46 #include "chrome/common/render_messages.h" 47 #include "chrome/common/render_messages.h"
47 #include "content/public/browser/browser_thread.h" 48 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/host_zoom_map.h" 49 #include "content/public/browser/host_zoom_map.h"
49 #include "content/public/browser/notification_service.h" 50 #include "content/public/browser/notification_service.h"
50 #include "content/public/browser/notification_types.h" 51 #include "content/public/browser/notification_types.h"
51 #include "content/public/browser/render_process_host.h" 52 #include "content/public/browser/render_process_host.h"
53 #include "content/public/browser/storage_partition.h"
52 #include "content/public/browser/web_contents.h" 54 #include "content/public/browser/web_contents.h"
53 #include "net/base/transport_security_state.h" 55 #include "net/base/transport_security_state.h"
54 #include "net/http/http_server_properties.h" 56 #include "net/http/http_server_properties.h"
55 #include "webkit/database/database_tracker.h" 57 #include "webkit/database/database_tracker.h"
56 58
57 #if defined(OS_ANDROID) 59 #if defined(OS_ANDROID)
58 #include "chrome/browser/prefs/scoped_user_pref_update.h" 60 #include "chrome/browser/prefs/scoped_user_pref_update.h"
59 #endif 61 #endif
60 62
61 #if defined(OS_CHROMEOS) 63 #if defined(OS_CHROMEOS)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 GetDownloadManagerDelegate(); 272 GetDownloadManagerDelegate();
271 } 273 }
272 274
273 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() { 275 net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContext() {
274 return io_data_.GetMainRequestContextGetter(); 276 return io_data_.GetMainRequestContextGetter();
275 } 277 }
276 278
277 net::URLRequestContextGetter* 279 net::URLRequestContextGetter*
278 OffTheRecordProfileImpl::GetRequestContextForRenderProcess( 280 OffTheRecordProfileImpl::GetRequestContextForRenderProcess(
279 int renderer_child_id) { 281 int renderer_child_id) {
282 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
283 renderer_child_id);
284 CHECK(rph);
285 content::StoragePartition* storage_partition = rph->GetStoragePartition();
286
280 ExtensionService* extension_service = 287 ExtensionService* extension_service =
281 extensions::ExtensionSystem::Get(this)->extension_service(); 288 extensions::ExtensionSystem::Get(this)->extension_service();
282 if (extension_service) { 289 if (extension_service) {
283 const extensions::Extension* extension = 290 const extensions::Extension* extension =
284 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 291 extension_service->GetIsolatedAppForRenderer(renderer_child_id);
285 if (extension) 292 if (extension)
286 return GetRequestContextForStoragePartition(extension->id()); 293 return GetRequestContextForStoragePartition(
294 storage_partition->GetPath(),
295 storage_partition->IsInMemoryOnly());
287 } 296 }
288 297
289 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 298 if (rph->IsGuest()) {
290 renderer_child_id);
291 if (rph && rph->IsGuest()) {
292 // For guest processes (used by the browser tag), we need to isolate the 299 // For guest processes (used by the browser tag), we need to isolate the
293 // storage. 300 // storage.
294 // TODO(nasko): Until we have proper storage partitions, create a 301 // TODO(nasko): Pass the proper value for in_memory when the browser tag
295 // non-persistent context using the RPH's id. 302 // is wired properly with storage partition
296 std::string id("guest-"); 303 return GetRequestContextForStoragePartition(
297 id.append(base::IntToString(renderer_child_id)); 304 storage_partition->GetPath(), true);
298 return GetRequestContextForStoragePartition(id);
299 } 305 }
300 306
301 return GetRequestContext(); 307 return GetRequestContext();
302 } 308 }
303 309
304 net::URLRequestContextGetter* 310 net::URLRequestContextGetter*
305 OffTheRecordProfileImpl::GetMediaRequestContext() { 311 OffTheRecordProfileImpl::GetMediaRequestContext() {
306 // In OTR mode, media request context is the same as the original one. 312 // In OTR mode, media request context is the same as the original one.
307 return GetRequestContext(); 313 return GetRequestContext();
308 } 314 }
309 315
310 net::URLRequestContextGetter* 316 net::URLRequestContextGetter*
311 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess( 317 OffTheRecordProfileImpl::GetMediaRequestContextForRenderProcess(
312 int renderer_child_id) { 318 int renderer_child_id) {
313 // In OTR mode, media request context is the same as the original one. 319 // In OTR mode, media request context is the same as the original one.
314 return GetRequestContextForRenderProcess(renderer_child_id); 320 return GetRequestContextForRenderProcess(renderer_child_id);
315 } 321 }
316 322
317 net::URLRequestContextGetter* 323 net::URLRequestContextGetter*
318 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( 324 OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition(
319 const std::string& partition_id) { 325 const FilePath& partition_path,
320 return GetRequestContextForStoragePartition(partition_id); 326 const bool& in_memory) {
327 return GetRequestContextForStoragePartition(partition_path, in_memory);
321 } 328 }
322 329
323 net::URLRequestContextGetter* 330 net::URLRequestContextGetter*
324 OffTheRecordProfileImpl::GetRequestContextForExtensions() { 331 OffTheRecordProfileImpl::GetRequestContextForExtensions() {
325 return io_data_.GetExtensionsRequestContextGetter(); 332 return io_data_.GetExtensionsRequestContextGetter();
326 } 333 }
327 334
328 net::URLRequestContextGetter* 335 net::URLRequestContextGetter*
329 OffTheRecordProfileImpl::GetRequestContextForStoragePartition( 336 OffTheRecordProfileImpl::GetRequestContextForStoragePartition(
330 const std::string& partition_id) { 337 const FilePath& partition_path,
331 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 338 const bool& in_memory) {
339 StoragePartitionDetails details(partition_path, in_memory);
340 return io_data_.GetIsolatedAppRequestContextGetter(details);
332 } 341 }
333 342
334 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { 343 content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() {
335 return io_data_.GetResourceContext(); 344 return io_data_.GetResourceContext();
336 } 345 }
337 346
338 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() { 347 net::SSLConfigService* OffTheRecordProfileImpl::GetSSLConfigService() {
339 return profile_->GetSSLConfigService(); 348 return profile_->GetSSLConfigService();
340 } 349 }
341 350
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 if (!profile) 515 if (!profile)
507 profile = new OffTheRecordProfileImpl(this); 516 profile = new OffTheRecordProfileImpl(this);
508 profile->Init(); 517 profile->Init();
509 return profile; 518 return profile;
510 } 519 }
511 520
512 base::Callback<ChromeURLDataManagerBackend*(void)> 521 base::Callback<ChromeURLDataManagerBackend*(void)>
513 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const { 522 OffTheRecordProfileImpl::GetChromeURLDataManagerBackendGetter() const {
514 return io_data_.GetChromeURLDataManagerBackendGetter(); 523 return io_data_.GetChromeURLDataManagerBackendGetter();
515 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698