diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 03:04:09 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-18 03:04:09 +0000 |
commit | 10eb2816fd7d28974114910aa5bfc105366a187f (patch) | |
tree | 7584d8faaa940e6ce8bb08320004ff402160b60e /chrome/browser | |
parent | f37a6bc327a34487e61beab79c3ec06390a42320 (diff) | |
download | chromium_src-10eb2816fd7d28974114910aa5bfc105366a187f.zip chromium_src-10eb2816fd7d28974114910aa5bfc105366a187f.tar.gz chromium_src-10eb2816fd7d28974114910aa5bfc105366a187f.tar.bz2 |
continuing from http://http://codereview.chromium.org/10823241
This intentionally doesn't change the ChromeOS behavior at all. They all still use the default FileSystemContext.
This code also exposes the normal and media URLRequestGetters via the StoragePartition, and cleans up a bit of code that was accessing the URLRequestGetter in odd ways. Also, it makes Workers correctly use the Media Cache for Media fetches.
TBR=benjhyden,sky,davemoore,piman,mkwst,kalman
BUG=85121
Review URL: https://chromiumcodereview.appspot.com/10909182
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
22 files changed, 133 insertions, 76 deletions
diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc index c1bd432..568af77 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc @@ -12,25 +12,28 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browsing_data/browsing_data_helper.h" -#include "chrome/browser/profiles/profile.h" #include "content/public/browser/browser_thread.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_quota_util.h" #include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/sandbox_mount_point_provider.h" -using content::BrowserContext; using content::BrowserThread; +namespace fileapi { +class FileSystemContext; +} + namespace { // An implementation of the BrowsingDataFileSystemHelper interface that pulls -// data from a given |profile| and returns a list of FileSystemInfo items to a -// client. +// data from a given |filesystem_context| and returns a list of FileSystemInfo +// items to a client. class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper { public: // BrowsingDataFileSystemHelper implementation - explicit BrowsingDataFileSystemHelperImpl(Profile* profile); + explicit BrowsingDataFileSystemHelperImpl( + fileapi::FileSystemContext* filesystem_context); virtual void StartFetching(const base::Callback< void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE; @@ -77,8 +80,8 @@ class BrowsingDataFileSystemHelperImpl : public BrowsingDataFileSystemHelper { }; BrowsingDataFileSystemHelperImpl::BrowsingDataFileSystemHelperImpl( - Profile* profile) - : filesystem_context_(BrowserContext::GetFileSystemContext(profile)), + fileapi::FileSystemContext* filesystem_context) + : filesystem_context_(filesystem_context), is_fetching_(false) { DCHECK(filesystem_context_); } @@ -184,8 +187,8 @@ BrowsingDataFileSystemHelper::FileSystemInfo::~FileSystemInfo() {} // static BrowsingDataFileSystemHelper* BrowsingDataFileSystemHelper::Create( - Profile* profile) { - return new BrowsingDataFileSystemHelperImpl(profile); + fileapi::FileSystemContext* filesystem_context) { + return new BrowsingDataFileSystemHelperImpl(filesystem_context); } CannedBrowsingDataFileSystemHelper::CannedBrowsingDataFileSystemHelper( diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper.h b/chrome/browser/browsing_data/browsing_data_file_system_helper.h index 89d685c..8029a36 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.h +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.h @@ -18,6 +18,10 @@ #include "googleurl/src/gurl.h" #include "webkit/fileapi/file_system_types.h" +namespace fileapi { +class FileSystemContext; +} + class Profile; // Defines an interface for classes that deal with aggregating and deleting @@ -70,7 +74,8 @@ class BrowsingDataFileSystemHelper // // The BrowsingDataFileSystemHelper will not change the profile itself, but // can modify data it contains (by removing file systems). - static BrowsingDataFileSystemHelper* Create(Profile* profile); + static BrowsingDataFileSystemHelper* Create( + fileapi::FileSystemContext* file_system_context); // Starts the process of fetching file system data, which will call |callback| // upon completion, passing it a constant list of FileSystemInfo objects. diff --git a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc index d60e8f2..f12551d 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc @@ -12,6 +12,7 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" #include "chrome/test/base/testing_profile.h" +#include "content/public/browser/storage_partition.h" #include "content/public/test/test_browser_thread.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_types.h" @@ -69,7 +70,10 @@ class BrowsingDataFileSystemHelperTest : public testing::Test { BrowserThread::FILE_USER_BLOCKING, &message_loop_), io_thread_(BrowserThread::IO, &message_loop_) { profile_.reset(new TestingProfile()); - helper_ = BrowsingDataFileSystemHelper::Create(profile_.get()); + + helper_ = BrowsingDataFileSystemHelper::Create( + BrowserContext::GetDefaultStoragePartition(profile_.get())-> + GetFileSystemContext()); message_loop_.RunAllPending(); canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get()); } @@ -148,8 +152,8 @@ class BrowsingDataFileSystemHelperTest : public testing::Test { // Sets up kOrigin1 with a temporary file system, kOrigin2 with a persistent // file system, and kOrigin3 with both. virtual void PopulateTestFileSystemData() { - sandbox_ = BrowserContext::GetFileSystemContext(profile_.get())-> - sandbox_provider(); + sandbox_ = BrowserContext::GetDefaultStoragePartition(profile_.get())-> + GetFileSystemContext()->sandbox_provider(); CreateDirectoryForOriginAndType(kOrigin1, kTemporary); CreateDirectoryForOriginAndType(kOrigin2, kPersistent); diff --git a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc index eaded3e..08ceef8 100644 --- a/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc +++ b/chrome/browser/chromeos/extensions/external_filesystem_apitest.cc @@ -25,8 +25,10 @@ #include "chrome/common/chrome_notification_types.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/storage_partition.h" #include "content/public/test/test_utils.h" #include "testing/gmock/include/gmock/gmock.h" #include "webkit/fileapi/file_system_context.h" @@ -165,8 +167,8 @@ class FileSystemExtensionApiTest : public ExtensionApiTest { // Adds a local mount point at at mount point /tmp. void AddTmpMountPoint() { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(browser()->profile())-> - external_provider(); + BrowserContext::GetDefaultStoragePartition( + browser()->profile())->GetFileSystemContext()->external_provider(); provider->AddLocalMountPoint(test_mount_point_); } diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc index 9d6b92c..9814bb6 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api.cc @@ -54,6 +54,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/storage_partition.h" #include "googleurl/src/gurl.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -335,11 +336,13 @@ void FileHandlerSelectFileFunction::OnFilePathSelected( // We have to open file system in order to create a FileEntry object for the // selected file path. - BrowserContext::GetFileSystemContext(profile_)->OpenFileSystem( - source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, - base::Bind(&RunOpenFileSystemCallback, - base::Bind(&FileHandlerSelectFileFunction::OnFileSystemOpened, - this))); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext()->OpenFileSystem( + source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, + base::Bind( + &RunOpenFileSystemCallback, + base::Bind(&FileHandlerSelectFileFunction::OnFileSystemOpened, + this))); }; void FileHandlerSelectFileFunction::OnFileSystemOpened( @@ -362,7 +365,8 @@ void FileHandlerSelectFileFunction::OnFileSystemOpened( void FileHandlerSelectFileFunction::GrantPermissions() { fileapi::ExternalFileSystemMountPointProvider* external_provider = - BrowserContext::GetFileSystemContext(profile_)->external_provider(); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext()->external_provider(); DCHECK(external_provider); external_provider->GetVirtualPath(full_path_, &virtual_path_); diff --git a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc index fb62f68..5ffca6c 100644 --- a/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_browser_handler_api_test.cc @@ -18,6 +18,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" +#include "content/public/browser/browser_context.h" +#include "content/public/browser/storage_partition.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -171,8 +173,8 @@ class FileBrowserHandlerExtensionTest : public ExtensionApiTest { // Creates new, test mount point. void AddTmpMountPoint() { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(browser()->profile())-> - external_provider(); + BrowserContext::GetDefaultStoragePartition(browser()->profile())-> + GetFileSystemContext()->external_provider(); provider->AddLocalMountPoint(tmp_mount_point_); } diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc index a9bb688..078cd52 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc @@ -49,6 +49,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/storage_partition.h" #include "googleurl/src/gurl.h" #include "grit/generated_resources.h" #include "grit/platform_locale_settings.h" @@ -175,7 +176,8 @@ void AddDriveMountPoint( const std::string& extension_id, content::RenderViewHost* render_view_host) { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(profile)->external_provider(); + BrowserContext::GetDefaultStoragePartition(profile)-> + GetFileSystemContext()->external_provider(); if (!provider) return; @@ -453,7 +455,8 @@ bool RequestLocalFileSystemFunction::RunImpl() { return false; scoped_refptr<fileapi::FileSystemContext> file_system_context = - BrowserContext::GetFileSystemContext(profile_); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind( @@ -515,7 +518,8 @@ bool FileWatchBrowserFunctionBase::RunImpl() { GURL file_watch_url(url); scoped_refptr<fileapi::FileSystemContext> file_system_context = - BrowserContext::GetFileSystemContext(profile_); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind( @@ -971,7 +975,8 @@ void FileBrowserFunction::GetLocalPathsOnFileThreadAndRunCallbackOnUIThread( const UrlList& file_urls, GetLocalPathsCallback callback) { scoped_refptr<fileapi::FileSystemContext> file_system_context = - BrowserContext::GetFileSystemContext(profile_); + BrowserContext::GetDefaultStoragePartition(profile())-> + GetFileSystemContext(); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind( @@ -2503,9 +2508,10 @@ bool SearchDriveFunction::RunImpl() { if (!args_->GetString(1, &next_feed_)) return false; - BrowserContext::GetFileSystemContext(profile())->OpenFileSystem( - source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, - base::Bind(&SearchDriveFunction::OnFileSystemOpened, this)); + BrowserContext::GetDefaultStoragePartition(profile())-> + GetFileSystemContext()->OpenFileSystem( + source_url_.GetOrigin(), fileapi::kFileSystemTypeExternal, false, + base::Bind(&SearchDriveFunction::OnFileSystemOpened, this)); return true; } diff --git a/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc b/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc index 8fdab44..ad5fe65 100644 --- a/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc +++ b/chrome/browser/chromeos/extensions/file_browser_private_apitest.cc @@ -10,7 +10,9 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/ui_test_utils.h" #include "chromeos/disks/mock_disk_mount_manager.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/storage_partition.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -186,8 +188,8 @@ class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { void AddTmpMountPoint() { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(browser()->profile())-> - external_provider(); + BrowserContext::GetDefaultStoragePartition(browser()->profile())-> + GetFileSystemContext()->external_provider(); provider->AddLocalMountPoint(test_mount_point_); } diff --git a/chrome/browser/chromeos/extensions/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_handler_util.cc index d26447d..afe5614 100644 --- a/chrome/browser/chromeos/extensions/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_handler_util.cc @@ -32,6 +32,7 @@ #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/site_instance.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "net/base/escape.h" #include "webkit/chromeos/fileapi/cros_mount_point_provider.h" @@ -752,9 +753,10 @@ bool ExtensionTaskExecutor::ExecuteAndNotify( done_ = done; - // Get local file system instance on file thread. scoped_refptr<fileapi::FileSystemContext> file_system_context = - BrowserContext::GetFileSystemContext(profile()); + BrowserContext::GetDefaultStoragePartition(profile())-> + GetFileSystemContext(); + BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind( diff --git a/chrome/browser/chromeos/extensions/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager_util.cc index f765324..2191f0a 100644 --- a/chrome/browser/chromeos/extensions/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager_util.cc @@ -41,6 +41,7 @@ #include "chrome/common/url_constants.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/plugin_service.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/user_metrics.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" @@ -304,7 +305,8 @@ bool ConvertFileToFileSystemUrl( bool ConvertFileToRelativeFileSystemPath( Profile* profile, const FilePath& full_file_path, FilePath* virtual_path) { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(profile)->external_provider(); + BrowserContext::GetDefaultStoragePartition(profile)-> + GetFileSystemContext()->external_provider(); if (!provider) return false; @@ -587,7 +589,8 @@ bool ExecuteDefaultHandler(Profile* profile, const FilePath& path) { // If File Browser has not been open yet then it did not request access // to the file system. Do it now. fileapi::ExternalFileSystemMountPointProvider* external_provider = - BrowserContext::GetFileSystemContext(profile)->external_provider(); + BrowserContext::GetDefaultStoragePartition( + profile)->GetFileSystemContext()->external_provider(); if (!external_provider) return false; external_provider->GrantFullAccessToExtension(source_url.host()); diff --git a/chrome/browser/chromeos/gdata/drive_system_service.cc b/chrome/browser/chromeos/gdata/drive_system_service.cc index d1688e5..99c8f30 100644 --- a/chrome/browser/chromeos/gdata/drive_system_service.cc +++ b/chrome/browser/chromeos/gdata/drive_system_service.cc @@ -24,6 +24,7 @@ #include "chrome/browser/profiles/profile_dependency_manager.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/storage_partition.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" @@ -140,7 +141,8 @@ void DriveSystemService::AddDriveMountPoint() { const FilePath mount_point = gdata::util::GetDriveMountPointPath(); fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(profile_)->external_provider(); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext()->external_provider(); if (provider && !provider->HasMountPoint(mount_point)) { provider->AddRemoteMountPoint( mount_point, @@ -156,7 +158,8 @@ void DriveSystemService::RemoveDriveMountPoint() { const FilePath mount_point = gdata::util::GetDriveMountPointPath(); fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(profile_)->external_provider(); + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext()->external_provider(); if (provider && provider->HasMountPoint(mount_point)) provider->RemoveMountPoint(mount_point); } diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index bad27f0..aee109d 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -35,6 +35,7 @@ #include "content/public/browser/download_manager.h" #include "content/public/browser/download_persistent_store_info.h" #include "content/public/browser/notification_service.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" #include "content/public/test/download_test_observer.h" @@ -680,7 +681,8 @@ class HTML5FileWriter { events_listener_(events_listener), blob_data_(new webkit_blob::BlobData()), payload_(payload), - fs_(BrowserContext::GetFileSystemContext(profile_)) { + fs_(BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext()) { CHECK(profile_); CHECK(events_listener_); CHECK(fs_); diff --git a/chrome/browser/extensions/data_deleter.cc b/chrome/browser/extensions/data_deleter.cc index 9ce58a8..07cc87a 100644 --- a/chrome/browser/extensions/data_deleter.cc +++ b/chrome/browser/extensions/data_deleter.cc @@ -93,15 +93,14 @@ DataDeleter::DataDeleter( extension_request_context_ = profile->GetRequestContextForExtensions(); } else if (is_storage_isolated) { extension_request_context_ = - profile->GetRequestContextForIsolatedApp(extension_id); + profile->GetRequestContextForStoragePartition(extension_id); isolated_app_path_ = profile->GetPath().Append( content::StoragePartition::GetPartitionPath(extension_id)); } else { extension_request_context_ = profile->GetRequestContext(); } - - file_system_context_ = BrowserContext::GetFileSystemContext(profile); + file_system_context_ = storage_partition->GetFileSystemContext(); indexed_db_context_ = storage_partition->GetIndexedDBContext(); storage_origin_ = storage_origin; diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 8cbd725..96b9ad2 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -121,6 +121,7 @@ #include "chrome/browser/chromeos/extensions/media_player_event_router.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" #include "chrome/browser/extensions/api/input_ime/input_ime_api.h" +#include "content/public/browser/storage_partition.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" #endif @@ -1107,10 +1108,12 @@ void ExtensionService::NotifyExtensionUnloaded( profile_, extension->GetChromeURLOverrides()); #if defined(OS_CHROMEOS) - // Revoke external file access to - if (BrowserContext::GetFileSystemContext(profile_) && - BrowserContext::GetFileSystemContext(profile_)->external_provider()) { - BrowserContext::GetFileSystemContext(profile_)->external_provider()-> + // Revoke external file access to third party extensions. + fileapi::FileSystemContext* filesystem_context = + BrowserContext::GetDefaultStoragePartition(profile_)-> + GetFileSystemContext(); + if (filesystem_context && filesystem_context->external_provider()) { + filesystem_context->external_provider()-> RevokeAccessForExtension(extension->id()); } diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index ca279e0..722a17a 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -252,7 +252,7 @@ net::URLRequestContextGetter* const extensions::Extension* installed_app = GetExtensionService()-> GetInstalledAppForRenderer(renderer_child_id); if (installed_app != NULL && installed_app->is_storage_isolated()) { - return GetRequestContextForIsolatedApp(installed_app->id()); + return GetRequestContextForStoragePartition(installed_app->id()); } } @@ -265,7 +265,7 @@ net::URLRequestContextGetter* // non-persistent context using the RPH's id. std::string id("guest-"); id.append(base::IntToString(renderer_child_id)); - return GetRequestContextForIsolatedApp(id); + return GetRequestContextForStoragePartition(id); } return GetRequestContext(); @@ -285,14 +285,20 @@ net::URLRequestContextGetter* } net::URLRequestContextGetter* +OffTheRecordProfileImpl::GetMediaRequestContextForStoragePartition( + const std::string& partition_id) { + return GetRequestContextForStoragePartition(partition_id); +} + +net::URLRequestContextGetter* OffTheRecordProfileImpl::GetRequestContextForExtensions() { return io_data_.GetExtensionsRequestContextGetter(); } net::URLRequestContextGetter* - OffTheRecordProfileImpl::GetRequestContextForIsolatedApp( - const std::string& app_id) { - return io_data_.GetIsolatedAppRequestContextGetter(app_id); + OffTheRecordProfileImpl::GetRequestContextForStoragePartition( + const std::string& partition_id) { + return io_data_.GetIsolatedAppRequestContextGetter(partition_id); } content::ResourceContext* OffTheRecordProfileImpl::GetResourceContext() { diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 0ec4628..be2278c 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -52,8 +52,8 @@ class OffTheRecordProfileImpl : public Profile, virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForExtensions() OVERRIDE; - virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( - const std::string& app_id) OVERRIDE; + virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( + const std::string& partition_id) OVERRIDE; virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; @@ -93,6 +93,9 @@ class OffTheRecordProfileImpl : public Profile, virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; + virtual net::URLRequestContextGetter* + GetMediaRequestContextForStoragePartition( + const std::string& partition_id) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index a0ec37c..69d59ad 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -117,11 +117,6 @@ bool Profile::IsGuestSession() { #endif } -net::URLRequestContextGetter* Profile::GetRequestContextForStoragePartition( - const std::string& partition_id) { - return GetRequestContextForIsolatedApp(partition_id); -} - bool Profile::IsSyncAccessible() { browser_sync::SyncPrefs prefs(GetPrefs()); return ProfileSyncService::IsSyncEnabled() && !prefs.IsManaged(); diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index d41bd32..3e3688d 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -237,17 +237,13 @@ class Profile : public content::BrowserContext { // Returns the main request context. virtual net::URLRequestContextGetter* GetRequestContext() = 0; - virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( - const std::string& partition_id) OVERRIDE; - // Returns the request context used for extension-related requests. This // is only used for a separate cookie store currently. virtual net::URLRequestContextGetter* GetRequestContextForExtensions() = 0; - // Returns the request context used within an installed app that has - // requested isolated storage. - virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( - const std::string& app_id) = 0; + // Returns the request context used within |partition_id|. + virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( + const std::string& partition_id) = 0; // Returns the SSLConfigService for this profile. virtual net::SSLConfigService* GetSSLConfigService() = 0; diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 809ade67..9fc6403 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -680,7 +680,7 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( const extensions::Extension* installed_app = extension_service-> GetInstalledAppForRenderer(renderer_child_id); if (installed_app && installed_app->is_storage_isolated()) - return GetRequestContextForIsolatedApp(installed_app->id()); + return GetRequestContextForStoragePartition(installed_app->id()); } content::RenderProcessHost* rph = content::RenderProcessHost::FromID( @@ -692,7 +692,7 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( // non-persistent context using the RPH's id. std::string id("guest-"); id.append(base::IntToString(renderer_child_id)); - return GetRequestContextForIsolatedApp(id); + return GetRequestContextForStoragePartition(id); } return GetRequestContext(); @@ -730,6 +730,12 @@ ProfileImpl::GetMediaRequestContextForRenderProcess( return io_data_.GetMediaRequestContextGetter(); } +net::URLRequestContextGetter* +ProfileImpl::GetMediaRequestContextForStoragePartition( + const std::string& partition_id) { + return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); +} + content::ResourceContext* ProfileImpl::GetResourceContext() { return io_data_.GetResourceContext(); } @@ -738,9 +744,9 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { return io_data_.GetExtensionsRequestContextGetter(); } -net::URLRequestContextGetter* ProfileImpl::GetRequestContextForIsolatedApp( - const std::string& app_id) { - return io_data_.GetIsolatedAppRequestContextGetter(app_id); +net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( + const std::string& partition_id) { + return io_data_.GetIsolatedAppRequestContextGetter(partition_id); } net::SSLConfigService* ProfileImpl::GetSSLConfigService() { diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index 925e863..b714d39 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -57,9 +57,14 @@ class ProfileImpl : public Profile, virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; + virtual net::URLRequestContextGetter* GetRequestContextForStoragePartition( + const std::string& partition_id) OVERRIDE; virtual net::URLRequestContextGetter* GetMediaRequestContext() OVERRIDE; virtual net::URLRequestContextGetter* GetMediaRequestContextForRenderProcess( int renderer_child_id) OVERRIDE; + virtual net::URLRequestContextGetter* + GetMediaRequestContextForStoragePartition( + const std::string& partition_id) OVERRIDE; virtual content::ResourceContext* GetResourceContext() OVERRIDE; virtual content::GeolocationPermissionContext* GetGeolocationPermissionContext() OVERRIDE; @@ -91,8 +96,6 @@ class ProfileImpl : public Profile, virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; virtual net::URLRequestContextGetter* GetRequestContextForExtensions() OVERRIDE; - virtual net::URLRequestContextGetter* GetRequestContextForIsolatedApp( - const std::string& app_id) OVERRIDE; virtual net::SSLConfigService* GetSSLConfigService() OVERRIDE; virtual HostContentSettingsMap* GetHostContentSettingsMap() OVERRIDE; virtual ProtocolHandlerRegistry* GetProtocolHandlerRegistry() OVERRIDE; diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc index f0c94f7..f47e926 100644 --- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc +++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc @@ -19,9 +19,11 @@ #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/common/chrome_paths.h" +#include "content/public/browser/browser_context.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/storage_partition.h" #include "content/public/test/test_utils.h" #include "ui/base/dialogs/select_file_dialog.h" #include "ui/base/dialogs/selected_file_info.h" @@ -112,8 +114,8 @@ class SelectFileDialogExtensionBrowserTest : public ExtensionBrowserTest { // Creates a file system mount point for a directory. void AddMountPoint(const FilePath& path) { fileapi::ExternalFileSystemMountPointProvider* provider = - BrowserContext::GetFileSystemContext(browser()->profile())-> - external_provider(); + BrowserContext::GetDefaultStoragePartition(browser()->profile())-> + GetFileSystemContext()->external_provider(); provider->AddLocalMountPoint(path); } diff --git a/chrome/browser/ui/webui/options/cookies_view_handler.cc b/chrome/browser/ui/webui/options/cookies_view_handler.cc index 6cb5721..065c3dc 100644 --- a/chrome/browser/ui/webui/options/cookies_view_handler.cc +++ b/chrome/browser/ui/webui/options/cookies_view_handler.cc @@ -30,6 +30,10 @@ #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" +namespace fileapi { +class FileSystemContext; +} + namespace options { CookiesViewHandler::CookiesViewHandler() @@ -194,6 +198,8 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { content::BrowserContext::GetDefaultStoragePartition(profile); content::IndexedDBContext* indexed_db_context = storage_partition->GetIndexedDBContext(); + fileapi::FileSystemContext* file_system_context = + storage_partition->GetFileSystemContext(); apps_map[std::string()] = new LocalDataContainer( "Site Data", std::string(), new BrowsingDataCookieHelper(profile->GetRequestContext()), @@ -202,7 +208,7 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { NULL, new BrowsingDataAppCacheHelper(profile), BrowsingDataIndexedDBHelper::Create(indexed_db_context), - BrowsingDataFileSystemHelper::Create(profile), + BrowsingDataFileSystemHelper::Create(file_system_context), BrowsingDataQuotaHelper::Create(profile), BrowsingDataServerBoundCertHelper::Create(profile), BrowsingDataFlashLSOHelper::Create(profile)); @@ -223,7 +229,7 @@ void CookiesViewHandler::EnsureCookiesTreeModelCreated() { it != extensions->end(); ++it) { if ((*it)->is_storage_isolated()) { net::URLRequestContextGetter* context_getter = - profile->GetRequestContextForIsolatedApp((*it)->id()); + profile->GetRequestContextForStoragePartition((*it)->id()); // TODO(nasko): When new types of storage are isolated, add the // appropriate browsing data helper objects to the constructor. // For now, just cookies are isolated, so other parameters are NULL. |