Chromium Code Reviews| 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/profile_impl.h" | 5 #include "chrome/browser/profiles/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/environment.h" | 10 #include "base/environment.h" |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 676 return io_data_.GetMainRequestContextGetter(); | 676 return io_data_.GetMainRequestContextGetter(); |
| 677 } | 677 } |
| 678 | 678 |
| 679 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 679 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 680 int renderer_child_id) { | 680 int renderer_child_id) { |
| 681 ExtensionService* extension_service = | 681 ExtensionService* extension_service = |
| 682 extensions::ExtensionSystem::Get(this)->extension_service(); | 682 extensions::ExtensionSystem::Get(this)->extension_service(); |
| 683 if (extension_service) { | 683 if (extension_service) { |
| 684 const extensions::Extension* installed_app = extension_service-> | 684 const extensions::Extension* installed_app = extension_service-> |
| 685 GetInstalledAppForRenderer(renderer_child_id); | 685 GetInstalledAppForRenderer(renderer_child_id); |
| 686 if (installed_app != NULL && installed_app->is_storage_isolated()) { | 686 if (installed_app != NULL && installed_app->is_storage_isolated()) |
| 687 return GetRequestContextForIsolatedApp(installed_app->id()); | 687 return GetRequestContextForIsolatedApp(installed_app->id()); |
| 688 } | |
| 689 } | 688 } |
| 690 | 689 |
| 691 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 690 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 692 renderer_child_id); | 691 renderer_child_id); |
| 693 if (rph && rph->IsGuest()) { | 692 if (rph && rph->IsGuest()) { |
| 694 // For guest processes (used by the browser tag), we need to isolate the | 693 // For guest processes (used by the browser tag), we need to isolate the |
| 695 // storage. | 694 // storage. |
| 696 // TODO(nasko): Until we have proper storage partitions, create a | 695 // TODO(nasko): Until we have proper storage partitions, create a |
| 697 // non-persistent context using the RPH's id. | 696 // non-persistent context using the RPH's id. |
| 698 std::string id("guest-"); | 697 std::string id("guest-"); |
| 699 id.append(base::IntToString(renderer_child_id)); | 698 id.append(base::IntToString(renderer_child_id)); |
| 700 return GetRequestContextForIsolatedApp(id); | 699 return GetRequestContextForIsolatedApp(id); |
| 701 } | 700 } |
| 702 | 701 |
| 703 return GetRequestContext(); | 702 return GetRequestContext(); |
| 704 } | 703 } |
| 705 | 704 |
| 706 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { | 705 net::URLRequestContextGetter* ProfileImpl::GetDefaultRequestContextForMedia() { |
| 706 // Return the default media context. | |
| 707 return io_data_.GetMediaRequestContextGetter(); | 707 return io_data_.GetMediaRequestContextGetter(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia( | |
| 711 int renderer_child_id) { | |
| 712 ExtensionService* extension_service = | |
| 713 extensions::ExtensionSystem::Get(this)->extension_service(); | |
| 714 if (extension_service) { | |
| 715 const extensions::Extension* installed_app = extension_service-> | |
| 716 GetInstalledAppForRenderer(renderer_child_id); | |
| 717 if (installed_app != NULL && installed_app->is_storage_isolated()) | |
|
awong
2012/08/20 19:46:28
nit: I think this is more often written as:
if (
Charlie Reis
2012/08/20 20:21:01
Done, here and above.
| |
| 718 return io_data_.GetIsolatedMediaRequestContextGetter(installed_app->id()); | |
| 719 } | |
| 720 | |
| 721 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | |
| 722 renderer_child_id); | |
| 723 if (rph && rph->IsGuest()) { | |
| 724 // For guest processes (used by the browser tag), we need to isolate the | |
| 725 // storage. | |
| 726 // TODO(nasko): Until we have proper storage partitions, create a | |
| 727 // non-persistent context using the RPH's id. | |
| 728 std::string id("guest-"); | |
| 729 id.append(base::IntToString(renderer_child_id)); | |
| 730 return io_data_.GetIsolatedMediaRequestContextGetter(id); | |
| 731 } | |
| 732 | |
| 733 return io_data_.GetMediaRequestContextGetter(); | |
| 734 } | |
| 735 | |
| 710 content::ResourceContext* ProfileImpl::GetResourceContext() { | 736 content::ResourceContext* ProfileImpl::GetResourceContext() { |
| 711 return io_data_.GetResourceContext(); | 737 return io_data_.GetResourceContext(); |
| 712 } | 738 } |
| 713 | 739 |
| 714 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { | 740 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { |
| 715 if (!favicon_service_created_) { | 741 if (!favicon_service_created_) { |
| 716 favicon_service_created_ = true; | 742 favicon_service_created_ = true; |
| 717 favicon_service_.reset(new FaviconService(this)); | 743 favicon_service_.reset(new FaviconService(this)); |
| 718 } | 744 } |
| 719 return favicon_service_.get(); | 745 return favicon_service_.get(); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1075 if (!path.empty()) | 1101 if (!path.empty()) |
| 1076 *cache_path = path; | 1102 *cache_path = path; |
| 1077 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1103 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1078 prefs_->GetInteger(prefs::kDiskCacheSize); | 1104 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1079 } | 1105 } |
| 1080 | 1106 |
| 1081 base::Callback<ChromeURLDataManagerBackend*(void)> | 1107 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1082 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1108 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1083 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1109 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1084 } | 1110 } |
| OLD | NEW |