diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-09 01:22:32 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-09 01:22:32 +0000 |
commit | f19bbf6c744effbec923b99f0bf99bc3fc13e3ff (patch) | |
tree | b20155f7dc0dd550c234229f1af615902c0a278e | |
parent | 814de9746a16fe9ce661bc140e238643b8e0bdc2 (diff) | |
download | chromium_src-f19bbf6c744effbec923b99f0bf99bc3fc13e3ff.zip chromium_src-f19bbf6c744effbec923b99f0bf99bc3fc13e3ff.tar.gz chromium_src-f19bbf6c744effbec923b99f0bf99bc3fc13e3ff.tar.bz2 |
fileapi: Rename FileSystemMountProvider to FileSystemBackend
The old name is a misnomer as this class no longer provides mount points!
Per some discussion, FileSystemBackend matches what the class is currently
doing and trying to be.
BUG=257016
TEST=none
TBR=hidehiko@chromium.org, joi@chromium.org, kinuko@chromium.org, vandebo@chromium.org
# for one-line #include renames in
chrome/browser/browsing_data/browsing_data_file_system_helper.cc
chrome/browser/extensions/component_loader.cc
chrome/browser/extensions/extension_service.cc
Review URL: https://codereview.chromium.org/18344013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@210480 0039d316-1c4b-4281-b951-d872f2087c98
77 files changed, 621 insertions, 640 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 70a7155..e1ed4b5 100644 --- a/chrome/browser/browsing_data/browsing_data_file_system_helper.cc +++ b/chrome/browser/browsing_data/browsing_data_file_system_helper.cc @@ -16,7 +16,7 @@ #include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_quota_util.h" #include "webkit/browser/fileapi/file_system_task_runners.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/common/fileapi/file_system_types.h" using content::BrowserThread; diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index e0e0fb7..5abfa6c 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -148,8 +148,8 @@ #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" #elif defined(OS_CHROMEOS) #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" -#include "chrome/browser/chromeos/drive/mount_point_provider_delegate.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/user_manager.h" #include "chrome/browser/chromeos/system/statistics_provider.h" @@ -187,7 +187,7 @@ #endif #if !defined(OS_ANDROID) -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #endif #if defined(ENABLE_WEBRTC) @@ -2305,29 +2305,29 @@ void ChromeContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( additional_allowed_schemes->push_back(extensions::kExtensionScheme); } -void ChromeContentBrowserClient::GetAdditionalFileSystemMountPointProviders( +void ChromeContentBrowserClient::GetAdditionalFileSystemBackends( const base::FilePath& storage_partition_path, quota::SpecialStoragePolicy* special_storage_policy, fileapi::ExternalMountPoints* external_mount_points, - ScopedVector<fileapi::FileSystemMountPointProvider>* additional_providers) { + ScopedVector<fileapi::FileSystemBackend>* additional_backends) { #if !defined(OS_ANDROID) base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); - additional_providers->push_back(new MediaFileSystemMountPointProvider( + additional_backends->push_back(new MediaFileSystemBackend( storage_partition_path, pool->GetSequencedTaskRunner(pool->GetNamedSequenceToken( - MediaFileSystemMountPointProvider::kMediaTaskRunnerName)).get())); + MediaFileSystemBackend::kMediaTaskRunnerName)).get())); #endif #if defined(OS_CHROMEOS) DCHECK(external_mount_points); - chromeos::CrosMountPointProvider* cros_mount_provider = - new chromeos::CrosMountPointProvider( - new drive::MountPointProviderDelegate(external_mount_points), + chromeos::FileSystemBackend* backend = + new chromeos::FileSystemBackend( + new drive::FileSystemBackendDelegate(external_mount_points), special_storage_policy, external_mount_points, fileapi::ExternalMountPoints::GetSystemInstance()); - cros_mount_provider->AddSystemMountPoints(); - DCHECK(cros_mount_provider->CanHandleType(fileapi::kFileSystemTypeExternal)); - additional_providers->push_back(cros_mount_provider); + backend->AddSystemMountPoints(); + DCHECK(backend->CanHandleType(fileapi::kFileSystemTypeExternal)); + additional_backends->push_back(backend); #endif } diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index c0caa16..96a2bb5 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -242,12 +242,11 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { content::WebContents* web_contents) OVERRIDE; virtual void GetAdditionalAllowedSchemesForFileSystem( std::vector<std::string>* additional_schemes) OVERRIDE; - virtual void GetAdditionalFileSystemMountPointProviders( + virtual void GetAdditionalFileSystemBackends( const base::FilePath& storage_partition_path, quota::SpecialStoragePolicy* special_storage_policy, fileapi::ExternalMountPoints* external_mount_points, - ScopedVector<fileapi::FileSystemMountPointProvider>* - additional_providers) OVERRIDE; + ScopedVector<fileapi::FileSystemBackend>* additional_backends) OVERRIDE; #if defined(OS_POSIX) && !defined(OS_MACOSX) virtual void GetAdditionalMappedFilesForChildProcess( diff --git a/chrome/browser/chromeos/drive/mount_point_provider_delegate.cc b/chrome/browser/chromeos/drive/file_system_backend_delegate.cc index 9ded16e..f090aed 100644 --- a/chrome/browser/chromeos/drive/mount_point_provider_delegate.cc +++ b/chrome/browser/chromeos/drive/file_system_backend_delegate.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/drive/mount_point_provider_delegate.h" +#include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" #include "chrome/browser/chromeos/drive/remote_file_stream_writer.h" #include "chrome/browser/chromeos/fileapi/remote_file_system_operation.h" @@ -16,15 +16,15 @@ using content::BrowserThread; namespace drive { -MountPointProviderDelegate::MountPointProviderDelegate( +FileSystemBackendDelegate::FileSystemBackendDelegate( fileapi::ExternalMountPoints* mount_points) : mount_points_(mount_points) { } -MountPointProviderDelegate::~MountPointProviderDelegate() { +FileSystemBackendDelegate::~FileSystemBackendDelegate() { } -fileapi::AsyncFileUtil* MountPointProviderDelegate::GetAsyncFileUtil( +fileapi::AsyncFileUtil* FileSystemBackendDelegate::GetAsyncFileUtil( fileapi::FileSystemType type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK_EQ(fileapi::kFileSystemTypeDrive, type); @@ -35,7 +35,7 @@ fileapi::AsyncFileUtil* MountPointProviderDelegate::GetAsyncFileUtil( } scoped_ptr<webkit_blob::FileStreamReader> -MountPointProviderDelegate::CreateFileStreamReader( +FileSystemBackendDelegate::CreateFileStreamReader( const fileapi::FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -54,7 +54,7 @@ MountPointProviderDelegate::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -MountPointProviderDelegate::CreateFileStreamWriter( +FileSystemBackendDelegate::CreateFileStreamWriter( const fileapi::FileSystemURL& url, int64 offset, fileapi::FileSystemContext* context) { @@ -72,7 +72,7 @@ MountPointProviderDelegate::CreateFileStreamWriter( } fileapi::FileSystemOperation* -MountPointProviderDelegate::CreateFileSystemOperation( +FileSystemBackendDelegate::CreateFileSystemOperation( const fileapi::FileSystemURL& url, fileapi::FileSystemContext* context, base::PlatformFileError* error_code) { diff --git a/chrome/browser/chromeos/drive/mount_point_provider_delegate.h b/chrome/browser/chromeos/drive/file_system_backend_delegate.h index b5a4734..4cb916e 100644 --- a/chrome/browser/chromeos/drive/mount_point_provider_delegate.h +++ b/chrome/browser/chromeos/drive/file_system_backend_delegate.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_MOUNT_POINT_PROVIDER_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_DRIVE_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_BACKEND_DELEGATE_H_ +#define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_BACKEND_DELEGATE_H_ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" namespace fileapi { class ExternalMountPoints; @@ -15,16 +15,15 @@ class ExternalMountPoints; namespace drive { -// Delegate implementation of the some methods in CrosMountPointProvider +// Delegate implementation of the some methods in chromeos::FileSystemBackend // for Drive file system. -class MountPointProviderDelegate - : public chromeos::CrosMountPointProviderDelegate { +class FileSystemBackendDelegate : public chromeos::FileSystemBackendDelegate { public: - explicit MountPointProviderDelegate( + explicit FileSystemBackendDelegate( fileapi::ExternalMountPoints* mount_points); - virtual ~MountPointProviderDelegate(); + virtual ~FileSystemBackendDelegate(); - // CrosMountPointProvider::Delegate overrides. + // FileSystemBackend::Delegate overrides. virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( fileapi::FileSystemType type) OVERRIDE; virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( @@ -44,9 +43,9 @@ class MountPointProviderDelegate private: scoped_refptr<fileapi::ExternalMountPoints> mount_points_; - DISALLOW_COPY_AND_ASSIGN(MountPointProviderDelegate); + DISALLOW_COPY_AND_ASSIGN(FileSystemBackendDelegate); }; } // namespace drive -#endif // CHROME_BROWSER_CHROMEOS_DRIVE_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_SYSTEM_BACKEND_DELEGATE_H_ diff --git a/chrome/browser/chromeos/drive/file_system_proxy.cc b/chrome/browser/chromeos/drive/file_system_proxy.cc index 1377ff7..2271049 100644 --- a/chrome/browser/chromeos/drive/file_system_proxy.cc +++ b/chrome/browser/chromeos/drive/file_system_proxy.cc @@ -383,7 +383,7 @@ FileSystemProxy::CreateFileStreamReader( } FileSystemProxy::~FileSystemProxy() { - // Should be deleted from the CrosMountPointProvider on UI thread. + // Should be deleted from the FileSystemBackend on UI thread. DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); } diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc index db0f346..513eaa6 100644 --- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc @@ -14,8 +14,8 @@ #include "chrome/test/base/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/isolated_context.h" @@ -103,7 +103,7 @@ TEST(FileSystemUtilTest, ExtractDrivePathFromFileSystemUrl) { mount_points.get(), NULL, // special_storage_policy NULL, // quota_manager_proxy, - ScopedVector<fileapi::FileSystemMountPointProvider>(), + ScopedVector<fileapi::FileSystemBackend>(), temp_dir_.path(), // partition_path fileapi::CreateAllowFileAccessOptions())); diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc index cfe538b..16bf4fd 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc @@ -21,7 +21,7 @@ // - The function grants permissions needed to read/write/create file under the // selected path. To grant permissions to the caller, caller's extension ID // has to be allowed to access the files virtual path (e.g. /Downloads/foo) -// in ExternalFileSystemMountPointProvider. Additionally, the callers render +// in ExternalFileSystemBackend. Additionally, the callers render // process ID has to be granted read, write and create permissions for the // selected file's full filesystem path (e.g. // /home/chronos/user/Downloads/foo) in ChildProcessSecurityPolicy. @@ -48,8 +48,8 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/storage_partition.h" #include "ui/shell_dialogs/select_file_dialog.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" using content::BrowserContext; using content::BrowserThread; @@ -367,18 +367,18 @@ void FileBrowserHandlerInternalSelectFileFunction::OnFileSystemOpened( void FileBrowserHandlerInternalSelectFileFunction::GrantPermissions() { content::SiteInstance* site_instance = render_view_host()->GetSiteInstance(); - fileapi::ExternalFileSystemMountPointProvider* external_provider = + fileapi::ExternalFileSystemBackend* external_backend = BrowserContext::GetStoragePartition(profile_, site_instance)-> - GetFileSystemContext()->external_provider(); - DCHECK(external_provider); + GetFileSystemContext()->external_backend(); + DCHECK(external_backend); - external_provider->GetVirtualPath(full_path_, &virtual_path_); + external_backend->GetVirtualPath(full_path_, &virtual_path_); DCHECK(!virtual_path_.empty()); // Grant access to this particular file to target extension. This will // ensure that the target extension can access only this FS entry and // prevent from traversing FS hierarchy upward. - external_provider->GrantFileAccessToExtension(extension_id(), virtual_path_); + external_backend->GrantFileAccessToExtension(extension_id(), virtual_path_); // Grant access to the selected file to target extensions render view process. content::ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc index 0bc7b95..c2936f2 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.cc @@ -35,7 +35,7 @@ #include "chrome/browser/chromeos/extensions/file_manager/file_manager_event_router.h" #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" #include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/system/statistics_provider.h" #include "chrome/browser/extensions/api/file_handlers/app_file_handler_util.h" @@ -219,10 +219,10 @@ void SetDriveMountPointPermissions( } content::SiteInstance* site_instance = render_view_host->GetSiteInstance(); - fileapi::ExternalFileSystemMountPointProvider* provider = + fileapi::ExternalFileSystemBackend* backend = BrowserContext::GetStoragePartition(profile, site_instance)-> - GetFileSystemContext()->external_provider(); - if (!provider) + GetFileSystemContext()->external_backend(); + if (!backend) return; const base::FilePath mount_point = drive::util::GetDriveMountPointPath(); @@ -233,8 +233,8 @@ void SetDriveMountPointPermissions( file_handler_util::GetReadWritePermissions()); base::FilePath mount_point_virtual; - if (provider->GetVirtualPath(mount_point, &mount_point_virtual)) - provider->GrantFileAccessToExtension(extension_id, mount_point_virtual); + if (backend->GetVirtualPath(mount_point, &mount_point_virtual)) + backend->GrantFileAccessToExtension(extension_id, mount_point_virtual); } // Finds an icon in the list of icons. If unable to find an icon of the exact @@ -540,17 +540,17 @@ bool RequestFileSystemFunction::SetupFileSystemAccessPermissions( return false; } - fileapi::ExternalFileSystemMountPointProvider* provider = - file_system_context->external_provider(); - if (!provider) + fileapi::ExternalFileSystemBackend* backend = + file_system_context->external_backend(); + if (!backend) return false; // Grant full access to File API from this component extension. - provider->GrantFullAccessToExtension(extension_->id()); + backend->GrantFullAccessToExtension(extension_->id()); // Grant R/W file permissions to the renderer hosting component - // extension for all paths exposed by our local file system provider. - std::vector<base::FilePath> root_dirs = provider->GetRootDirectories(); + // extension for all paths exposed by our local file system backend. + std::vector<base::FilePath> root_dirs = backend->GetRootDirectories(); for (size_t i = 0; i < root_dirs.size(); ++i) { ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( child_id, root_dirs[i], @@ -906,7 +906,7 @@ bool GetFileTasksFileBrowserFunction::RunImpl() { GURL file_url(file_url_str); fileapi::FileSystemURL file_system_url( file_system_context->CrackURL(file_url)); - if (!chromeos::CrosMountPointProvider::CanHandleURL(file_system_url)) + if (!chromeos::FileSystemBackend::CanHandleURL(file_system_url)) continue; file_urls.push_back(file_url); @@ -1045,7 +1045,7 @@ bool ExecuteTasksFileBrowserFunction::RunImpl() { return false; } FileSystemURL url = file_system_context->CrackURL(GURL(file_url_str)); - if (!chromeos::CrosMountPointProvider::CanHandleURL(url)) { + if (!chromeos::FileSystemBackend::CanHandleURL(url)) { error_ = kInvalidFileUrl; return false; } @@ -1163,7 +1163,7 @@ base::FilePath FileBrowserFunction::GetLocalPathFromURL(const GURL& url) { const fileapi::FileSystemURL filesystem_url( file_system_context->CrackURL(url)); base::FilePath path; - if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) + if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) return base::FilePath(); return filesystem_url.path(); } @@ -3056,7 +3056,7 @@ bool ValidatePathNameLengthFunction::RunImpl() { GetFileSystemContext(); fileapi::FileSystemURL filesystem_url( file_system_context->CrackURL(GURL(parent_url))); - if (!chromeos::CrosMountPointProvider::CanHandleURL(filesystem_url)) + if (!chromeos::FileSystemBackend::CanHandleURL(filesystem_url)) return false; // No explicit limit on the length of Drive file names. diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h index c408946..b339a70 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_private_api.h @@ -81,7 +81,7 @@ class FileBrowserFunction : public AsyncExtensionFunction { int32 GetTabId() const; // Returns the local FilePath associated with |url|. If the file isn't of the - // type CrosMountPointProvider handles, returns an empty FilePath. + // type FileSystemBackend handles, returns an empty FilePath. // // Local paths will look like "/home/chronos/user/Downloads/foo/bar.txt" or // "/special/drive/foo/bar.txt". diff --git a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc index 2381079..180fce4 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc @@ -14,7 +14,7 @@ #include "chrome/browser/chromeos/drive/file_task_executor.h" #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler.h" #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "chrome/browser/extensions/event_router.h" #include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_service.h" @@ -187,10 +187,10 @@ bool FileBrowserHasAccessPermissionForFiles( const GURL& source_url, const std::string& file_browser_id, const std::vector<FileSystemURL>& files) { - fileapi::ExternalFileSystemMountPointProvider* external_provider = + fileapi::ExternalFileSystemBackend* backend = GetFileSystemContextForExtension(profile, file_browser_id)-> - external_provider(); - if (!external_provider) + external_backend(); + if (!backend) return false; for (size_t i = 0; i < files.size(); ++i) { @@ -198,8 +198,8 @@ bool FileBrowserHasAccessPermissionForFiles( if (source_url.GetOrigin() != files[i].origin()) return false; - if (!chromeos::CrosMountPointProvider::CanHandleURL(files[i]) || - !external_provider->IsAccessAllowed(files[i])) { + if (!chromeos::FileSystemBackend::CanHandleURL(files[i]) || + !backend->IsAccessAllowed(files[i])) { return false; } } @@ -629,8 +629,8 @@ ExtensionTaskExecutor::SetupFileAccessPermissions( DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); DCHECK(handler_extension.get()); - fileapi::ExternalFileSystemMountPointProvider* external_provider_handler = - file_system_context_handler->external_provider(); + fileapi::ExternalFileSystemBackend* backend = + file_system_context_handler->external_backend(); FileDefinitionList file_list; for (size_t i = 0; i < file_urls.size(); ++i) { @@ -658,7 +658,7 @@ ExtensionTaskExecutor::SetupFileAccessPermissions( // Grant access to this particular file to target extension. This will // ensure that the target extension can access only this FS entry and // prevent from traversing FS hierarchy upward. - external_provider_handler->GrantFileAccessToExtension( + backend->GrantFileAccessToExtension( handler_extension->id(), virtual_path); // Output values. diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_util.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_util.cc index 31d0d31..406ee4e 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_util.cc @@ -55,8 +55,8 @@ #include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/screen.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/common/fileapi/file_system_util.h" @@ -256,12 +256,12 @@ bool GrantFileSystemAccessToFileBrowser(Profile* profile) { // site for which file access permissions should be granted. GURL site = extensions::ExtensionSystem::Get(profile)->extension_service()-> GetSiteForExtensionId(kFileBrowserDomain); - fileapi::ExternalFileSystemMountPointProvider* external_provider = + fileapi::ExternalFileSystemBackend* backend = BrowserContext::GetStoragePartitionForSite(profile, site)-> - GetFileSystemContext()->external_provider(); - if (!external_provider) + GetFileSystemContext()->external_backend(); + if (!backend) return false; - external_provider->GrantFullAccessToExtension(GetFileBrowserUrl().host()); + backend->GrantFullAccessToExtension(GetFileBrowserUrl().host()); return true; } @@ -570,14 +570,14 @@ bool ConvertFileToRelativeFileSystemPath( // extension's site is the one in whose file system context the virtual path // should be found. GURL site = service->GetSiteForExtensionId(extension_id); - fileapi::ExternalFileSystemMountPointProvider* provider = + fileapi::ExternalFileSystemBackend* backend = BrowserContext::GetStoragePartitionForSite(profile, site)-> - GetFileSystemContext()->external_provider(); - if (!provider) + GetFileSystemContext()->external_backend(); + if (!backend) return false; - // Find if this file path is managed by the external provider. - if (!provider->GetVirtualPath(full_file_path, virtual_path)) + // Find if this file path is managed by the external backend. + if (!backend->GetVirtualPath(full_file_path, virtual_path)) return false; return true; diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc b/chrome/browser/chromeos/fileapi/file_system_backend.cc index 8c799d8..148e148 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.cc +++ b/chrome/browser/chromeos/fileapi/file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -11,8 +11,8 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h" #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend_delegate.h" #include "chromeos/dbus/cros_disks_client.h" #include "webkit/browser/blob/file_stream_reader.h" #include "webkit/browser/fileapi/async_file_util_adapter.h" @@ -37,7 +37,7 @@ const char kChromeUIScheme[] = "chrome"; namespace chromeos { // static -bool CrosMountPointProvider::CanHandleURL(const fileapi::FileSystemURL& url) { +bool FileSystemBackend::CanHandleURL(const fileapi::FileSystemURL& url) { if (!url.is_valid()) return false; return url.type() == fileapi::kFileSystemTypeNativeLocal || @@ -45,8 +45,8 @@ bool CrosMountPointProvider::CanHandleURL(const fileapi::FileSystemURL& url) { url.type() == fileapi::kFileSystemTypeDrive; } -CrosMountPointProvider::CrosMountPointProvider( - CrosMountPointProviderDelegate* drive_delegate, +FileSystemBackend::FileSystemBackend( + FileSystemBackendDelegate* drive_delegate, scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, scoped_refptr<fileapi::ExternalMountPoints> mount_points, fileapi::ExternalMountPoints* system_mount_points) @@ -59,10 +59,10 @@ CrosMountPointProvider::CrosMountPointProvider( system_mount_points_(system_mount_points) { } -CrosMountPointProvider::~CrosMountPointProvider() { +FileSystemBackend::~FileSystemBackend() { } -void CrosMountPointProvider::AddSystemMountPoints() { +void FileSystemBackend::AddSystemMountPoints() { // RegisterFileSystem() is no-op if the mount point with the same name // already exists, hence it's safe to call without checking if a mount // point already exists or not. @@ -93,7 +93,7 @@ void CrosMountPointProvider::AddSystemMountPoints() { base::FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); } -bool CrosMountPointProvider::CanHandleType(fileapi::FileSystemType type) const { +bool FileSystemBackend::CanHandleType(fileapi::FileSystemType type) const { switch (type) { case fileapi::kFileSystemTypeExternal: case fileapi::kFileSystemTypeDrive: @@ -106,7 +106,7 @@ bool CrosMountPointProvider::CanHandleType(fileapi::FileSystemType type) const { } } -void CrosMountPointProvider::OpenFileSystem( +void FileSystemBackend::OpenFileSystem( const GURL& origin_url, fileapi::FileSystemType type, fileapi::OpenFileSystemMode mode, @@ -116,12 +116,12 @@ void CrosMountPointProvider::OpenFileSystem( callback.Run(base::PLATFORM_FILE_OK); } -fileapi::FileSystemQuotaUtil* CrosMountPointProvider::GetQuotaUtil() { +fileapi::FileSystemQuotaUtil* FileSystemBackend::GetQuotaUtil() { // No quota support. return NULL; } -bool CrosMountPointProvider::IsAccessAllowed( +bool FileSystemBackend::IsAccessAllowed( const fileapi::FileSystemURL& url) const { if (!url.is_valid()) return false; @@ -147,7 +147,7 @@ bool CrosMountPointProvider::IsAccessAllowed( url.virtual_path()); } -void CrosMountPointProvider::GrantFullAccessToExtension( +void FileSystemBackend::GrantFullAccessToExtension( const std::string& extension_id) { DCHECK(special_storage_policy_->IsFileHandler(extension_id)); if (!special_storage_policy_->IsFileHandler(extension_id)) @@ -164,7 +164,7 @@ void CrosMountPointProvider::GrantFullAccessToExtension( } } -void CrosMountPointProvider::GrantFileAccessToExtension( +void FileSystemBackend::GrantFileAccessToExtension( const std::string& extension_id, const base::FilePath& virtual_path) { // All we care about here is access from extensions for now. DCHECK(special_storage_policy_->IsFileHandler(extension_id)); @@ -188,12 +188,12 @@ void CrosMountPointProvider::GrantFileAccessToExtension( file_access_permissions_->GrantAccessPermission(extension_id, virtual_path); } -void CrosMountPointProvider::RevokeAccessForExtension( +void FileSystemBackend::RevokeAccessForExtension( const std::string& extension_id) { file_access_permissions_->RevokePermissions(extension_id); } -std::vector<base::FilePath> CrosMountPointProvider::GetRootDirectories() const { +std::vector<base::FilePath> FileSystemBackend::GetRootDirectories() const { std::vector<fileapi::MountPoints::MountPointInfo> mount_points; mount_points_->AddMountPointInfosTo(&mount_points); system_mount_points_->AddMountPointInfosTo(&mount_points); @@ -204,14 +204,14 @@ std::vector<base::FilePath> CrosMountPointProvider::GetRootDirectories() const { return root_dirs; } -fileapi::FileSystemFileUtil* CrosMountPointProvider::GetFileUtil( +fileapi::FileSystemFileUtil* FileSystemBackend::GetFileUtil( fileapi::FileSystemType type) { DCHECK(type == fileapi::kFileSystemTypeNativeLocal || type == fileapi::kFileSystemTypeRestrictedNativeLocal); return local_file_util_->sync_file_util(); } -fileapi::AsyncFileUtil* CrosMountPointProvider::GetAsyncFileUtil( +fileapi::AsyncFileUtil* FileSystemBackend::GetAsyncFileUtil( fileapi::FileSystemType type) { if (type == fileapi::kFileSystemTypeDrive) return drive_delegate_->GetAsyncFileUtil(type); @@ -222,14 +222,14 @@ fileapi::AsyncFileUtil* CrosMountPointProvider::GetAsyncFileUtil( } fileapi::CopyOrMoveFileValidatorFactory* -CrosMountPointProvider::GetCopyOrMoveFileValidatorFactory( +FileSystemBackend::GetCopyOrMoveFileValidatorFactory( fileapi::FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; return NULL; } -fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation( +fileapi::FileSystemOperation* FileSystemBackend::CreateFileSystemOperation( const fileapi::FileSystemURL& url, fileapi::FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -253,7 +253,7 @@ fileapi::FileSystemOperation* CrosMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -CrosMountPointProvider::CreateFileStreamReader( +FileSystemBackend::CreateFileStreamReader( const fileapi::FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -274,7 +274,7 @@ CrosMountPointProvider::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -CrosMountPointProvider::CreateFileStreamWriter( +FileSystemBackend::CreateFileStreamWriter( const fileapi::FileSystemURL& url, int64 offset, fileapi::FileSystemContext* context) const { @@ -295,14 +295,14 @@ CrosMountPointProvider::CreateFileStreamWriter( context->task_runners()->file_task_runner(), url.path(), offset)); } -bool CrosMountPointProvider::GetVirtualPath( +bool FileSystemBackend::GetVirtualPath( const base::FilePath& filesystem_path, base::FilePath* virtual_path) { return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); } -base::FilePath CrosMountPointProvider::GetFileSystemRootPath( +base::FilePath FileSystemBackend::GetFileSystemRootPath( const fileapi::FileSystemURL& url) const { DCHECK(fileapi::IsolatedContext::IsIsolatedType(url.mount_type())); if (!url.is_valid()) diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h b/chrome/browser/chromeos/fileapi/file_system_backend.h index 01d8891..22b1845 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider.h +++ b/chrome/browser/chromeos/fileapi/file_system_backend.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ -#define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ +#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ +#define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ #include <map> #include <string> @@ -13,7 +13,7 @@ #include "base/files/file_path.h" #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/quota/special_storage_policy.h" #include "webkit/browser/webkit_storage_browser_export.h" #include "webkit/common/fileapi/file_system_types.h" @@ -29,11 +29,11 @@ class IsolatedContext; namespace chromeos { -class CrosMountPointProviderDelegate; +class FileSystemBackendDelegate; class FileAccessPermissions; -// CrosMountPointProvider is a Chrome OS specific implementation of -// ExternalFileSystemMountPointProvider. This class is responsible for a +// FileSystemBackend is a Chrome OS specific implementation of +// ExternalFileSystemBackend. This class is responsible for a // number of things, including: // // - Add system mount points @@ -64,21 +64,20 @@ class FileAccessPermissions; // // filesystem:<origin>/external/<mount_name>/... // -class CrosMountPointProvider - : public fileapi::ExternalFileSystemMountPointProvider { +class FileSystemBackend : public fileapi::ExternalFileSystemBackend { public: - using fileapi::FileSystemMountPointProvider::OpenFileSystemCallback; + using fileapi::FileSystemBackend::OpenFileSystemCallback; - // CrosMountPointProvider will take an ownership of a |mount_points| + // FileSystemBackend will take an ownership of a |mount_points| // reference. On the other hand, |system_mount_points| will be kept as a raw - // pointer and it should outlive CrosMountPointProvider instance. + // pointer and it should outlive FileSystemBackend instance. // The ownership of |drive_delegate| is also taken. - CrosMountPointProvider( - CrosMountPointProviderDelegate* drive_delegate, + FileSystemBackend( + FileSystemBackendDelegate* drive_delegate, scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, scoped_refptr<fileapi::ExternalMountPoints> mount_points, fileapi::ExternalMountPoints* system_mount_points); - virtual ~CrosMountPointProvider(); + virtual ~FileSystemBackend(); // Adds system mount points, such as "archive", and "removable". This // function is no-op if these mount points are already present. @@ -89,7 +88,7 @@ class CrosMountPointProvider // This could be called on any threads. static bool CanHandleURL(const fileapi::FileSystemURL& url); - // fileapi::FileSystemMountPointProvider overrides. + // fileapi::FileSystemBackend overrides. virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -119,7 +118,7 @@ class CrosMountPointProvider fileapi::FileSystemContext* context) const OVERRIDE; virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - // fileapi::ExternalFileSystemMountPointProvider overrides. + // fileapi::ExternalFileSystemBackend overrides. virtual bool IsAccessAllowed(const fileapi::FileSystemURL& url) const OVERRIDE; virtual std::vector<base::FilePath> GetRootDirectories() const OVERRIDE; @@ -141,7 +140,7 @@ class CrosMountPointProvider scoped_ptr<fileapi::AsyncFileUtilAdapter> local_file_util_; // The Delegate instance for the drive file system related operation. - scoped_ptr<CrosMountPointProviderDelegate> drive_delegate_; + scoped_ptr<FileSystemBackendDelegate> drive_delegate_; // Mount points specific to the owning context (i.e. per-profile mount // points). @@ -157,12 +156,12 @@ class CrosMountPointProvider scoped_refptr<fileapi::ExternalMountPoints> mount_points_; // Globally visible mount points. System MountPonts instance should outlive - // all CrosMountPointProvider instances, so raw pointer is safe. + // all FileSystemBackend instances, so raw pointer is safe. fileapi::ExternalMountPoints* system_mount_points_; - DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider); + DISALLOW_COPY_AND_ASSIGN(FileSystemBackend); }; } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_H_ +#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_H_ diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h index 9b99c4d..4367d2e 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_delegate.h +++ b/chrome/browser/chromeos/fileapi/file_system_backend_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ -#define CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#ifndef CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ +#define CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" @@ -29,29 +29,29 @@ class FileStreamReader; namespace chromeos { // This is delegate interface to inject the implementation of the some methods -// of CrosMountPointProvider. The main goal is to inject Drive File System. -class CrosMountPointProviderDelegate { +// of FileSystemBackend. The main goal is to inject Drive File System. +class FileSystemBackendDelegate { public: - virtual ~CrosMountPointProviderDelegate() {} + virtual ~FileSystemBackendDelegate() {} - // Called from CrosMountPointProvider::GetAsyncFileUtil(). + // Called from FileSystemBackend::GetAsyncFileUtil(). virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( fileapi::FileSystemType type) = 0; - // Called from CrosMountPointProvider::CreateFileStreamReader(). + // Called from FileSystemBackend::CreateFileStreamReader(). virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( const fileapi::FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, fileapi::FileSystemContext* context) = 0; - // Called from CrosMountPointProvider::CreateFileStreamWriter(). + // Called from FileSystemBackend::CreateFileStreamWriter(). virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( const fileapi::FileSystemURL& url, int64 offset, fileapi::FileSystemContext* context) = 0; - // Called from CrosMountPointProvider::CreateFileSystemOperation(). + // Called from FileSystemBackend::CreateFileSystemOperation(). // TODO(hidehiko): Get rid of this method when we merge the // {Remote,Local}FileSystemOperation. virtual fileapi::FileSystemOperation* CreateFileSystemOperation( @@ -62,4 +62,4 @@ class CrosMountPointProviderDelegate { } // namespace chromeos -#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_CROS_MOUNT_POINT_PROVIDER_DELEGATE_H_ +#endif // CHROME_BROWSER_CHROMEOS_FILEAPI_FILE_SYSTEM_BACKEND_DELEGATE_H_ diff --git a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc index 222e54c..0bef727 100644 --- a/chrome/browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc +++ b/chrome/browser/chromeos/fileapi/file_system_backend_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/chromeos/fileapi/cros_mount_point_provider.h" +#include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include <set> @@ -33,18 +33,18 @@ FileSystemURL CreateFileSystemURL(const std::string& extension, base::FilePath::FromUTF8Unsafe(path)); } -TEST(CrosMountPointProviderTest, DefaultMountPoints) { +TEST(ChromeOSFileSystemBackendTest, DefaultMountPoints) { scoped_refptr<quota::SpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), fileapi::ExternalMountPoints::GetSystemInstance()); - provider.AddSystemMountPoints(); - std::vector<base::FilePath> root_dirs = provider.GetRootDirectories(); + backend.AddSystemMountPoints(); + std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); // By default there should be 4 mount points (in system mount points): @@ -60,7 +60,7 @@ TEST(CrosMountPointProviderTest, DefaultMountPoints) { EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/usr/share/oem")))); } -TEST(CrosMountPointProviderTest, GetRootDirectories) { +TEST(ChromeOSFileSystemBackendTest, GetRootDirectories) { scoped_refptr<quota::SpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( @@ -69,13 +69,13 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), system_mount_points.get()); - const size_t initial_root_dirs_size = provider.GetRootDirectories().size(); + const size_t initial_root_dirs_size = backend.GetRootDirectories().size(); // Register 'local' test mount points. mount_points->RegisterFileSystem("c", @@ -93,7 +93,7 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { fileapi::kFileSystemTypeNativeLocal, base::FilePath(FPL("/g/d/e"))); - std::vector<base::FilePath> root_dirs = provider.GetRootDirectories(); + std::vector<base::FilePath> root_dirs = backend.GetRootDirectories(); std::set<base::FilePath> root_dirs_set(root_dirs.begin(), root_dirs.end()); EXPECT_EQ(initial_root_dirs_size + 4, root_dirs.size()); EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/a/b/c")))); @@ -102,7 +102,7 @@ TEST(CrosMountPointProviderTest, GetRootDirectories) { EXPECT_TRUE(root_dirs_set.count(base::FilePath(FPL("/g/d/e")))); } -TEST(CrosMountPointProviderTest, AccessPermissions) { +TEST(ChromeOSFileSystemBackendTest, AccessPermissions) { url_util::AddStandardScheme("chrome-extension"); scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = @@ -111,7 +111,7 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::ExternalMountPoints::CreateRefCounted()); scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), @@ -135,47 +135,47 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::kFileSystemTypeRestrictedNativeLocal, base::FilePath(FPL("/usr/share/oem")))); - // Provider specific mount point access. - EXPECT_FALSE(provider.IsAccessAllowed( + // Backend specific mount point access. + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); - provider.GrantFileAccessToExtension(extension, + backend.GrantFileAccessToExtension(extension, base::FilePath(FPL("removable/foo"))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); // System mount point access. - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); - provider.GrantFileAccessToExtension(extension, + backend.GrantFileAccessToExtension(extension, base::FilePath(FPL("system/foo"))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo", system_mount_points.get()))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo1", system_mount_points.get()))); // oem is restricted file system. - provider.GrantFileAccessToExtension( + backend.GrantFileAccessToExtension( extension, base::FilePath(FPL("oem/foo"))); // The extension should not be able to access the file even if // GrantFileAccessToExtension was called. - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "oem/foo", mount_points.get()))); - provider.GrantFullAccessToExtension(extension); + backend.GrantFullAccessToExtension(extension); // The extension should be able to access restricted file system after it was // granted full access. - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "oem/foo", mount_points.get()))); // The extension which was granted full access should be able to access any // path on current file systems. - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo1", mount_points.get()))); - EXPECT_TRUE(provider.IsAccessAllowed( + EXPECT_TRUE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "system/foo1", system_mount_points.get()))); @@ -185,11 +185,11 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { "test", fileapi::kFileSystemTypeNativeLocal, base::FilePath(FPL("/foo/test")))); - EXPECT_FALSE(provider.IsAccessAllowed( + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "test_/foo", mount_points.get()))); - provider.RevokeAccessForExtension(extension); - EXPECT_FALSE(provider.IsAccessAllowed( + backend.RevokeAccessForExtension(extension); + EXPECT_FALSE(backend.IsAccessAllowed( CreateFileSystemURL(extension, "removable/foo", mount_points.get()))); fileapi::FileSystemURL internal_url = FileSystemURL::CreateForTest( @@ -197,17 +197,17 @@ TEST(CrosMountPointProviderTest, AccessPermissions) { fileapi::kFileSystemTypeExternal, base::FilePath(FPL("removable/"))); // Internal WebUI should have full access. - EXPECT_TRUE(provider.IsAccessAllowed(internal_url)); + EXPECT_TRUE(backend.IsAccessAllowed(internal_url)); } -TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { +TEST(ChromeOSFileSystemBackendTest, GetVirtualPathConflictWithSystemPoints) { scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); scoped_refptr<fileapi::ExternalMountPoints> mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); scoped_refptr<fileapi::ExternalMountPoints> system_mount_points( fileapi::ExternalMountPoints::CreateRefCounted()); - chromeos::CrosMountPointProvider provider( + chromeos::FileSystemBackend backend( NULL, // drive_delegate storage_policy, mount_points.get(), @@ -215,7 +215,7 @@ TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { const fileapi::FileSystemType type = fileapi::kFileSystemTypeNativeLocal; - // Provider specific mount points. + // Backend specific mount points. ASSERT_TRUE( mount_points->RegisterFileSystem("b", type, base::FilePath(FPL("/a/b")))); ASSERT_TRUE( @@ -256,7 +256,7 @@ TEST(CrosMountPointProvider, GetVirtualPathConflictWithSystemPoints) { base::FilePath virtual_path(FPL("/mount")); base::FilePath local_path(kTestCases[i].local_path); EXPECT_EQ(kTestCases[i].success, - provider.GetVirtualPath(local_path, &virtual_path)) + backend.GetVirtualPath(local_path, &virtual_path)) << "Resolving " << kTestCases[i].local_path; // There are no guarantees for |virtual_path| value if |GetVirtualPath| diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc index ee865ef..b029ce6 100644 --- a/chrome/browser/extensions/component_loader.cc +++ b/chrome/browser/extensions/component_loader.cc @@ -49,7 +49,7 @@ #include "chromeos/chromeos_switches.h" #include "content/public/browser/storage_partition.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #endif #if defined(ENABLE_APP_LIST) diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index a6851a7..ec7adfc 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -114,8 +114,8 @@ #if defined(OS_CHROMEOS) #include "chrome/browser/chromeos/extensions/install_limiter.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #endif using content::BrowserContext; @@ -1135,8 +1135,8 @@ void ExtensionService::NotifyExtensionUnloaded( fileapi::FileSystemContext* filesystem_context = BrowserContext::GetStoragePartitionForSite(profile_, site)-> GetFileSystemContext(); - if (filesystem_context && filesystem_context->external_provider()) { - filesystem_context->external_provider()-> + if (filesystem_context && filesystem_context->external_backend()) { + filesystem_context->external_backend()-> RevokeAccessForExtension(extension->id()); } #endif diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc index 29a7f11..5f935c5 100644 --- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc @@ -8,7 +8,7 @@ #include "base/file_util.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" @@ -44,7 +44,7 @@ MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( DCHECK(IsOnIOThread(context)); return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( context->GetUserValue<std::string>( - MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey)); + MediaFileSystemBackend::kMTPDeviceDelegateURLKey)); } // Called on a blocking pool thread to create a snapshot file to hold the diff --git a/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc b/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc index 951e91b..5ecc091 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_data_provider.cc @@ -13,12 +13,12 @@ #include "base/stl_util.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" #include "chrome/common/itunes_library.h" #include "content/public/browser/browser_thread.h" -using chrome::MediaFileSystemMountPointProvider; +using chrome::MediaFileSystemBackend; namespace itunes { @@ -72,7 +72,7 @@ void OnLibraryChanged(const base::FilePathWatcher::Callback& callback, const base::FilePath& path, bool error) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, base::Bind(callback, path, error)); } @@ -89,7 +89,7 @@ void StartLibraryWatchOnFileThread( base::Bind(&OnLibraryChanged, library_changed_callback)); if (!success) LOG(ERROR) << "Adding watch for " << library_path.value() << " failed"; - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, base::Bind(watch_started_callback, base::Passed(&watcher))); } @@ -100,7 +100,7 @@ ITunesDataProvider::ITunesDataProvider(const base::FilePath& library_path) : library_path_(library_path), needs_refresh_(true), is_valid_(false) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(!library_path_.empty()); content::BrowserThread::PostTask( @@ -117,7 +117,7 @@ ITunesDataProvider::~ITunesDataProvider() {} // TODO(vandebo): add a file watch that resets |needs_refresh_| when the // file changes. void ITunesDataProvider::RefreshData(const ReadyCallback& ready_callback) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); if (!needs_refresh_) { ready_callback.Run(is_valid_); return; @@ -135,14 +135,14 @@ const base::FilePath& ITunesDataProvider::library_path() const { } bool ITunesDataProvider::KnownArtist(const ArtistName& artist) const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); return ContainsKey(library_, artist); } bool ITunesDataProvider::KnownAlbum(const ArtistName& artist, const AlbumName& album) const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); Library::const_iterator library_it = library_.find(artist); if (library_it == library_.end()) @@ -153,7 +153,7 @@ bool ITunesDataProvider::KnownAlbum(const ArtistName& artist, base::FilePath ITunesDataProvider::GetTrackLocation( const ArtistName& artist, const AlbumName& album, const TrackName& track) const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); Library::const_iterator library_it = library_.find(artist); if (library_it == library_.end()) @@ -171,7 +171,7 @@ base::FilePath ITunesDataProvider::GetTrackLocation( std::set<ITunesDataProvider::ArtistName> ITunesDataProvider::GetArtistNames() const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); std::set<ArtistName> result; Library::const_iterator it; @@ -183,7 +183,7 @@ ITunesDataProvider::GetArtistNames() const { std::set<ITunesDataProvider::AlbumName> ITunesDataProvider::GetAlbumNames( const ArtistName& artist) const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); std::set<AlbumName> result; Library::const_iterator artist_lookup = library_.find(artist); @@ -200,7 +200,7 @@ std::set<ITunesDataProvider::AlbumName> ITunesDataProvider::GetAlbumNames( ITunesDataProvider::Album ITunesDataProvider::GetAlbum( const ArtistName& artist, const AlbumName& album) const { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(is_valid_); Album result; Library::const_iterator artist_lookup = library_.find(artist); @@ -215,7 +215,7 @@ ITunesDataProvider::Album ITunesDataProvider::GetAlbum( // static void ITunesDataProvider::OnLibraryWatchStartedCallback( scoped_ptr<base::FilePathWatcher> library_watcher) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); ITunesDataProvider* provider = chrome::ImportedMediaGalleryRegistry::ITunesDataProvider(); if (provider) @@ -225,7 +225,7 @@ void ITunesDataProvider::OnLibraryWatchStartedCallback( // static void ITunesDataProvider::OnLibraryChangedCallback(const base::FilePath& path, bool error) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); ITunesDataProvider* provider = chrome::ImportedMediaGalleryRegistry::ITunesDataProvider(); if (provider) @@ -237,7 +237,7 @@ void ITunesDataProvider::OnLibraryParsedCallback( const ReadyCallback& ready_callback, bool result, const parser::Library& library) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); ITunesDataProvider* provider = chrome::ImportedMediaGalleryRegistry::ITunesDataProvider(); if (!provider) { @@ -249,13 +249,13 @@ void ITunesDataProvider::OnLibraryParsedCallback( void ITunesDataProvider::OnLibraryWatchStarted( scoped_ptr<base::FilePathWatcher> library_watcher) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); library_watcher_.reset(library_watcher.release()); } void ITunesDataProvider::OnLibraryChanged(const base::FilePath& path, bool error) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK_EQ(library_path_.value(), path.value()); if (error) LOG(ERROR) << "Error watching " << library_path_.value(); @@ -265,7 +265,7 @@ void ITunesDataProvider::OnLibraryChanged(const base::FilePath& path, void ITunesDataProvider::OnLibraryParsed(const ReadyCallback& ready_callback, bool result, const parser::Library& library) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); is_valid_ = result; if (is_valid_) { library_.clear(); diff --git a/chrome/browser/media_galleries/fileapi/itunes_file_util.cc b/chrome/browser/media_galleries/fileapi/itunes_file_util.cc index d5e247d..88c32a1 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_file_util.cc @@ -12,7 +12,7 @@ #include "base/file_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" #include "content/public/browser/browser_thread.h" @@ -197,7 +197,7 @@ base::PlatformFileError ItunesFileUtil::ReadDirectorySync( return base::PLATFORM_FILE_ERROR_NOT_FOUND; chrome::MediaPathFilter* path_filter = context->GetUserValue<chrome::MediaPathFilter*>( - chrome::MediaFileSystemMountPointProvider::kMediaPathFilterKey); + chrome::MediaFileSystemBackend::kMediaPathFilterKey); ITunesDataProvider::Album::const_iterator it; for (it = album.begin(); it != album.end(); ++it) { base::PlatformFileInfo file_info; diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc index 3512e97..7709a52 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include <string> @@ -43,14 +43,14 @@ using fileapi::FileSystemURL; namespace chrome { -const char MediaFileSystemMountPointProvider::kMediaTaskRunnerName[] = +const char MediaFileSystemBackend::kMediaTaskRunnerName[] = "media-task-runner"; -const char MediaFileSystemMountPointProvider::kMediaPathFilterKey[] = +const char MediaFileSystemBackend::kMediaPathFilterKey[] = "MediaPathFilterKey"; -const char MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey[] = +const char MediaFileSystemBackend::kMTPDeviceDelegateURLKey[] = "MTPDeviceDelegateKey"; -MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( +MediaFileSystemBackend::MediaFileSystemBackend( const base::FilePath& profile_path, base::SequencedTaskRunner* media_task_runner) : profile_path_(profile_path), @@ -68,11 +68,11 @@ MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider( { } -MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() { +MediaFileSystemBackend::~MediaFileSystemBackend() { } // static -bool MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread() { +bool MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread() { base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); base::SequencedWorkerPool::SequenceToken media_sequence_token = pool->GetNamedSequenceToken(kMediaTaskRunnerName); @@ -81,14 +81,14 @@ bool MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread() { // static scoped_refptr<base::SequencedTaskRunner> -MediaFileSystemMountPointProvider::MediaTaskRunner() { +MediaFileSystemBackend::MediaTaskRunner() { base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); base::SequencedWorkerPool::SequenceToken media_sequence_token = pool->GetNamedSequenceToken(kMediaTaskRunnerName); return pool->GetSequencedTaskRunner(media_sequence_token); } -bool MediaFileSystemMountPointProvider::CanHandleType( +bool MediaFileSystemBackend::CanHandleType( fileapi::FileSystemType type) const { switch (type) { case fileapi::kFileSystemTypeNativeMedia: @@ -103,7 +103,7 @@ bool MediaFileSystemMountPointProvider::CanHandleType( } } -void MediaFileSystemMountPointProvider::OpenFileSystem( +void MediaFileSystemBackend::OpenFileSystem( const GURL& origin_url, fileapi::FileSystemType type, fileapi::OpenFileSystemMode mode, @@ -114,13 +114,13 @@ void MediaFileSystemMountPointProvider::OpenFileSystem( base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); } -fileapi::FileSystemFileUtil* MediaFileSystemMountPointProvider::GetFileUtil( +fileapi::FileSystemFileUtil* MediaFileSystemBackend::GetFileUtil( fileapi::FileSystemType type) { NOTREACHED(); return NULL; } -fileapi::AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil( +fileapi::AsyncFileUtil* MediaFileSystemBackend::GetAsyncFileUtil( fileapi::FileSystemType type) { switch (type) { case fileapi::kFileSystemTypeNativeMedia: @@ -140,7 +140,7 @@ fileapi::AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil( } fileapi::CopyOrMoveFileValidatorFactory* -MediaFileSystemMountPointProvider::GetCopyOrMoveFileValidatorFactory( +MediaFileSystemBackend::GetCopyOrMoveFileValidatorFactory( fileapi::FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; @@ -160,7 +160,7 @@ MediaFileSystemMountPointProvider::GetCopyOrMoveFileValidatorFactory( } fileapi::FileSystemOperation* -MediaFileSystemMountPointProvider::CreateFileSystemOperation( +MediaFileSystemBackend::CreateFileSystemOperation( const FileSystemURL& url, FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -180,7 +180,7 @@ MediaFileSystemMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -MediaFileSystemMountPointProvider::CreateFileStreamReader( +MediaFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -192,7 +192,7 @@ MediaFileSystemMountPointProvider::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -MediaFileSystemMountPointProvider::CreateFileStreamWriter( +MediaFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, int64 offset, FileSystemContext* context) const { @@ -203,7 +203,7 @@ MediaFileSystemMountPointProvider::CreateFileStreamWriter( } fileapi::FileSystemQuotaUtil* -MediaFileSystemMountPointProvider::GetQuotaUtil() { +MediaFileSystemBackend::GetQuotaUtil() { // No quota support. return NULL; } diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h index 45ba5eb..513d92c 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h +++ b/chrome/browser/media_galleries/fileapi/media_file_system_backend.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ -#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ +#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ +#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" namespace base { class SequencedTaskRunner; @@ -23,22 +23,21 @@ class MediaPathFilter; class DeviceMediaAsyncFileUtil; -class MediaFileSystemMountPointProvider - : public fileapi::FileSystemMountPointProvider { +class MediaFileSystemBackend : public fileapi::FileSystemBackend { public: static const char kMediaTaskRunnerName[]; static const char kMediaPathFilterKey[]; static const char kMTPDeviceDelegateURLKey[]; - MediaFileSystemMountPointProvider( + MediaFileSystemBackend( const base::FilePath& profile_path, base::SequencedTaskRunner* media_task_runner); - virtual ~MediaFileSystemMountPointProvider(); + virtual ~MediaFileSystemBackend(); static bool CurrentlyOnMediaTaskRunnerThread(); static scoped_refptr<base::SequencedTaskRunner> MediaTaskRunner(); - // FileSystemMountPointProvider implementation. + // FileSystemBackend implementation. virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -85,9 +84,9 @@ class MediaFileSystemMountPointProvider scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_; #endif // defined(OS_WIN) || defined(OS_MACOSX) - DISALLOW_COPY_AND_ASSIGN(MediaFileSystemMountPointProvider); + DISALLOW_COPY_AND_ASSIGN(MediaFileSystemBackend); }; } // namespace chrome -#endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ +#endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_BACKEND_H_ diff --git a/chrome/browser/media_galleries/fileapi/media_file_validator_unittest.cc b/chrome/browser/media_galleries/fileapi/media_file_validator_unittest.cc index 79d030f..5fde5e4 100644 --- a/chrome/browser/media_galleries/fileapi/media_file_validator_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/media_file_validator_unittest.cc @@ -9,19 +9,19 @@ #include "base/files/scoped_temp_dir.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/copy_or_move_file_validator.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/isolated_context.h" #include "webkit/browser/fileapi/mock_file_system_context.h" -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include "webkit/common/fileapi/file_system_types.h" namespace { @@ -88,10 +88,10 @@ class MediaFileValidatorTest : public InProcessBrowserTest { base::FilePath src_path = base.AppendASCII("src_fs"); ASSERT_TRUE(file_util::CreateDirectory(src_path)); - ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; - additional_providers.push_back(new fileapi::TestMountPointProvider( + ScopedVector<fileapi::FileSystemBackend> additional_providers; + additional_providers.push_back(new fileapi::TestFileSystemBackend( base::MessageLoopProxy::current().get(), src_path)); - additional_providers.push_back(new MediaFileSystemMountPointProvider( + additional_providers.push_back(new MediaFileSystemBackend( base, base::MessageLoopProxy::current().get())); file_system_context_ = fileapi::CreateFileSystemContextWithAdditionalProvidersForTesting( diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc index 29e33dc..ece1ad2 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc @@ -12,7 +12,7 @@ #include "base/files/file_enumerator.h" #include "base/strings/string_util.h" #include "base/task_runner_util.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "content/public/browser/browser_thread.h" #include "net/base/mime_sniffer.h" @@ -90,7 +90,7 @@ bool IsOnTaskRunnerThread(fileapi::FileSystemOperationContext* context) { MediaPathFilter* GetMediaPathFilter( fileapi::FileSystemOperationContext* context) { return context->GetUserValue<MediaPathFilter*>( - MediaFileSystemMountPointProvider::kMediaPathFilterKey); + MediaFileSystemBackend::kMediaPathFilterKey); } } // namespace diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc index 71f752f..e36e3e2 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc @@ -13,13 +13,13 @@ #include "base/message_loop/message_loop_proxy.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_url.h" @@ -125,8 +125,8 @@ class NativeMediaFileUtilTest : public testing::Test { scoped_refptr<quota::SpecialStoragePolicy> storage_policy = new quota::MockSpecialStoragePolicy(); - ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; - additional_providers.push_back(new MediaFileSystemMountPointProvider( + ScopedVector<fileapi::FileSystemBackend> additional_providers; + additional_providers.push_back(new MediaFileSystemBackend( data_dir_.path(), base::MessageLoopProxy::current().get())); file_system_context_ = new fileapi::FileSystemContext( diff --git a/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.cc b/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.cc index 15ce254..d15cb78 100644 --- a/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.cc @@ -13,7 +13,7 @@ #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/picasa/picasa_data_provider.h" #include "chrome/browser/media_galleries/imported_media_gallery_registry.h" #include "chrome/common/media_galleries/picasa_types.h" diff --git a/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util_unittest.cc b/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util_unittest.cc index 10ebb3a..3418dd4 100644 --- a/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util_unittest.cc +++ b/chrome/browser/media_galleries/fileapi/picasa/picasa_file_util_unittest.cc @@ -14,7 +14,7 @@ #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/time/time.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" #include "chrome/browser/media_galleries/fileapi/picasa/picasa_data_provider.h" #include "chrome/browser/media_galleries/fileapi/picasa/picasa_file_util.h" @@ -157,12 +157,12 @@ class TestPicasaFileUtil : public PicasaFileUtil { PicasaDataProvider* data_provider_; }; -class TestMediaFileSystemMountPointProvider - : public chrome::MediaFileSystemMountPointProvider { +class TestMediaFileSystemBackend + : public chrome::MediaFileSystemBackend { public: - TestMediaFileSystemMountPointProvider(const base::FilePath& profile_path, + TestMediaFileSystemBackend(const base::FilePath& profile_path, PicasaFileUtil* picasa_file_util) - : chrome::MediaFileSystemMountPointProvider( + : chrome::MediaFileSystemBackend( profile_path, base::MessageLoopProxy::current().get()), test_file_util_(picasa_file_util) {} @@ -234,8 +234,8 @@ class PicasaFileUtilTest : public testing::Test { picasa_data_provider_.reset(new TestPicasaDataProvider()); - ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; - additional_providers.push_back(new TestMediaFileSystemMountPointProvider( + ScopedVector<fileapi::FileSystemBackend> additional_providers; + additional_providers.push_back(new TestMediaFileSystemBackend( profile_dir_.path(), new TestPicasaFileUtil(picasa_data_provider_.get()))); @@ -399,7 +399,7 @@ TEST_F(PicasaFileUtilTest, NameDeduplication) { new chrome::MediaPathFilter()); operation_context->SetUserValue( - chrome::MediaFileSystemMountPointProvider::kMediaPathFilterKey, + chrome::MediaFileSystemBackend::kMediaPathFilterKey, media_path_filter.get()); scoped_ptr<TestPicasaDataProvider> test_picasa_data_provider( diff --git a/chrome/browser/media_galleries/fileapi/safe_itunes_library_parser.cc b/chrome/browser/media_galleries/fileapi/safe_itunes_library_parser.cc index 1935336..0ae9ef4 100644 --- a/chrome/browser/media_galleries/fileapi/safe_itunes_library_parser.cc +++ b/chrome/browser/media_galleries/fileapi/safe_itunes_library_parser.cc @@ -4,13 +4,13 @@ #include "chrome/browser/media_galleries/fileapi/safe_itunes_library_parser.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/common/chrome_utility_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_data.h" #include "ipc/ipc_platform_file.h" -using chrome::MediaFileSystemMountPointProvider; +using chrome::MediaFileSystemBackend; using content::BrowserThread; using content::UtilityProcessHost; @@ -24,7 +24,7 @@ SafeITunesLibraryParser::SafeITunesLibraryParser( parser_state_(INITIAL_STATE) {} void SafeITunesLibraryParser::Start() { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); // |itunes_library_platform_file_| will be closed on the IO thread once it // has been handed off to the child process. @@ -87,7 +87,7 @@ void SafeITunesLibraryParser::OnGotITunesLibrary( if (parser_state_ != STARTED_PARSING_STATE) return; - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, base::Bind(callback_, result, library)); parser_state_ = FINISHED_PARSING_STATE; diff --git a/chrome/browser/media_galleries/imported_media_gallery_registry.cc b/chrome/browser/media_galleries/imported_media_gallery_registry.cc index b9f6c13..5f4b435 100644 --- a/chrome/browser/media_galleries/imported_media_gallery_registry.cc +++ b/chrome/browser/media_galleries/imported_media_gallery_registry.cc @@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/logging.h" #include "chrome/browser/media_galleries/fileapi/itunes_data_provider.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/picasa/picasa_data_provider.h" #include "chrome/common/extensions/extension_constants.h" #include "content/public/browser/browser_thread.h" @@ -49,7 +49,7 @@ std::string ImportedMediaGalleryRegistry::RegisterPicasaFilesystemOnUIThread( picasa_fsids_.insert(fsid); if (picasa_fsids_.size() == 1) { - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, Bind(&ImportedMediaGalleryRegistry::RegisterPicasaFileSystem, base::Unretained(this), database_path)); @@ -83,7 +83,7 @@ std::string ImportedMediaGalleryRegistry::RegisterITunesFilesystemOnUIThread( itunes_fsids_.insert(fsid); if (itunes_fsids_.size() == 1) { - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, Bind(&ImportedMediaGalleryRegistry::RegisterITunesFileSystem, base::Unretained(this), library_xml_path)); @@ -105,7 +105,7 @@ bool ImportedMediaGalleryRegistry::RevokeImportedFilesystemOnUIThread( #if defined(OS_WIN) || defined(OS_MACOSX) if (picasa_fsids_.erase(fsid)) { if (picasa_fsids_.empty()) { - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, Bind(&ImportedMediaGalleryRegistry::RevokePicasaFileSystem, base::Unretained(this))); @@ -115,7 +115,7 @@ bool ImportedMediaGalleryRegistry::RevokeImportedFilesystemOnUIThread( if (itunes_fsids_.erase(fsid)) { if (itunes_fsids_.empty()) { - MediaFileSystemMountPointProvider::MediaTaskRunner()->PostTask( + MediaFileSystemBackend::MediaTaskRunner()->PostTask( FROM_HERE, Bind(&ImportedMediaGalleryRegistry::RevokeITunesFileSystem, base::Unretained(this))); @@ -131,7 +131,7 @@ bool ImportedMediaGalleryRegistry::RevokeImportedFilesystemOnUIThread( // static picasa::PicasaDataProvider* ImportedMediaGalleryRegistry::PicasaDataProvider() { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(GetInstance()->picasa_data_provider_); return GetInstance()->picasa_data_provider_.get(); } @@ -139,7 +139,7 @@ ImportedMediaGalleryRegistry::PicasaDataProvider() { // static itunes::ITunesDataProvider* ImportedMediaGalleryRegistry::ITunesDataProvider() { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(GetInstance()->itunes_data_provider_); return GetInstance()->itunes_data_provider_.get(); } @@ -157,26 +157,26 @@ ImportedMediaGalleryRegistry::~ImportedMediaGalleryRegistry() { #if defined(OS_WIN) || defined(OS_MACOSX) void ImportedMediaGalleryRegistry::RegisterPicasaFileSystem( const base::FilePath& database_path) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(!picasa_data_provider_); picasa_data_provider_.reset(new picasa::PicasaDataProvider(database_path)); } void ImportedMediaGalleryRegistry::RevokePicasaFileSystem() { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(picasa_data_provider_); picasa_data_provider_.reset(); } void ImportedMediaGalleryRegistry::RegisterITunesFileSystem( const base::FilePath& xml_library_path) { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(!itunes_data_provider_); itunes_data_provider_.reset(new itunes::ITunesDataProvider(xml_library_path)); } void ImportedMediaGalleryRegistry::RevokeITunesFileSystem() { - DCHECK(MediaFileSystemMountPointProvider::CurrentlyOnMediaTaskRunnerThread()); + DCHECK(MediaFileSystemBackend::CurrentlyOnMediaTaskRunnerThread()); DCHECK(itunes_data_provider_); itunes_data_provider_.reset(); } diff --git a/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc b/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc index 7d284bc..c29d4ae 100644 --- a/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc +++ b/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc @@ -5,7 +5,7 @@ #include "chrome/browser/media_galleries/scoped_mtp_device_map_entry.h" #include "base/bind.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" #include "chrome/browser/media_galleries/mtp_device_delegate_impl.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc index fa72b2d..55eaad2 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc @@ -22,7 +22,7 @@ #include "base/task_runner_util.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_restrictions.h" -#include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h" +#include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/media_galleries/win/mtp_device_object_entry.h" #include "chrome/browser/media_galleries/win/mtp_device_object_enumerator.h" #include "chrome/browser/media_galleries/win/mtp_device_operations_util.h" @@ -60,7 +60,7 @@ scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() { base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); base::SequencedWorkerPool::SequenceToken media_sequence_token = pool->GetNamedSequenceToken( - MediaFileSystemMountPointProvider::kMediaTaskRunnerName); + MediaFileSystemBackend::kMediaTaskRunnerName); return pool->GetSequencedTaskRunner(media_sequence_token); } diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index ec2573e..7402f9f 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -991,8 +991,8 @@ 'browser/media_galleries/fileapi/itunes_finder_mac.mm', 'browser/media_galleries/fileapi/itunes_finder_win.cc', 'browser/media_galleries/fileapi/itunes_finder_win.h', - 'browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc', - 'browser/media_galleries/fileapi/media_file_system_mount_point_provider.h', + 'browser/media_galleries/fileapi/media_file_system_backend.cc', + 'browser/media_galleries/fileapi/media_file_system_backend.h', 'browser/media_galleries/fileapi/media_file_validator_factory.h', 'browser/media_galleries/fileapi/media_file_validator_factory.cc', 'browser/media_galleries/fileapi/media_path_filter.cc', diff --git a/chrome/chrome_browser_chromeos.gypi b/chrome/chrome_browser_chromeos.gypi index dc44019..ac0cbec 100644 --- a/chrome/chrome_browser_chromeos.gypi +++ b/chrome/chrome_browser_chromeos.gypi @@ -269,6 +269,8 @@ 'browser/chromeos/drive/file_system/truncate_operation.h', 'browser/chromeos/drive/file_system/update_operation.cc', 'browser/chromeos/drive/file_system/update_operation.h', + 'browser/chromeos/drive/file_system_backend_delegate.cc', + 'browser/chromeos/drive/file_system_backend_delegate.h', 'browser/chromeos/drive/file_system_interface.h', 'browser/chromeos/drive/file_system_metadata.cc', 'browser/chromeos/drive/file_system_metadata.h', @@ -293,8 +295,6 @@ 'browser/chromeos/drive/local_file_reader.h', 'browser/chromeos/drive/logging.cc', 'browser/chromeos/drive/logging.h', - 'browser/chromeos/drive/mount_point_provider_delegate.cc', - 'browser/chromeos/drive/mount_point_provider_delegate.h', 'browser/chromeos/drive/remote_file_stream_writer.cc', 'browser/chromeos/drive/remote_file_stream_writer.h', 'browser/chromeos/drive/remove_stale_cache_files.cc', @@ -341,11 +341,11 @@ 'browser/chromeos/external_metrics.h', 'browser/chromeos/external_protocol_dialog.cc', 'browser/chromeos/external_protocol_dialog.h', - 'browser/chromeos/fileapi/cros_mount_point_provider.cc', - 'browser/chromeos/fileapi/cros_mount_point_provider.h', - 'browser/chromeos/fileapi/cros_mount_point_provider_delegate.h', 'browser/chromeos/fileapi/file_access_permissions.cc', 'browser/chromeos/fileapi/file_access_permissions.h', + 'browser/chromeos/fileapi/file_system_backend.cc', + 'browser/chromeos/fileapi/file_system_backend.h', + 'browser/chromeos/fileapi/file_system_backend_delegate.h', 'browser/chromeos/fileapi/remote_file_system_operation.cc', 'browser/chromeos/fileapi/remote_file_system_operation.h', 'browser/chromeos/imageburner/burn_controller.cc', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 6dd4905..f42bb32 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -642,8 +642,8 @@ 'browser/chromeos/extensions/file_manager/file_manager_notifications_unittest.cc', 'browser/chromeos/extensions/wallpaper_private_api_unittest.cc', 'browser/chromeos/external_metrics_unittest.cc', - 'browser/chromeos/fileapi/cros_mount_point_provider_unittest.cc', 'browser/chromeos/fileapi/file_access_permissions_unittest.cc', + 'browser/chromeos/fileapi/file_system_backend_unittest.cc', 'browser/chromeos/imageburner/burn_device_handler_unittest.cc', 'browser/chromeos/imageburner/burn_manager_unittest.cc', 'browser/chromeos/input_method/browser_state_monitor_unittest.cc', diff --git a/content/browser/fileapi/browser_file_system_helper.cc b/content/browser/fileapi/browser_file_system_helper.cc index 4944740..9d7f6ae 100644 --- a/content/browser/fileapi/browser_file_system_helper.cc +++ b/content/browser/fileapi/browser_file_system_helper.cc @@ -19,7 +19,7 @@ #include "content/public/common/url_constants.h" #include "webkit/browser/fileapi/external_mount_points.h" #include "webkit/browser/fileapi/file_permission_policy.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_options.h" #include "webkit/browser/fileapi/file_system_task_runners.h" @@ -64,8 +64,8 @@ scoped_refptr<fileapi::FileSystemContext> CreateFileSystemContext( file_task_runner.get())); // Setting up additional mount point providers. - ScopedVector<fileapi::FileSystemMountPointProvider> additional_providers; - GetContentClient()->browser()->GetAdditionalFileSystemMountPointProviders( + ScopedVector<fileapi::FileSystemBackend> additional_providers; + GetContentClient()->browser()->GetAdditionalFileSystemBackends( profile_path, special_storage_policy, external_mount_points, @@ -105,8 +105,8 @@ bool CheckFileSystemPermissionsForProcess( return false; } - fileapi::FileSystemMountPointProvider* mount_point_provider = - context->GetMountPointProvider(url.type()); + fileapi::FileSystemBackend* mount_point_provider = + context->GetFileSystemBackend(url.type()); if (!mount_point_provider) { *error = base::PLATFORM_FILE_ERROR_INVALID_URL; return false; diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 2b0e4e7..d6bc272 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -40,7 +40,7 @@ #include "webkit/common/fileapi/file_system_util.h" using fileapi::FileSystemFileUtil; -using fileapi::FileSystemMountPointProvider; +using fileapi::FileSystemBackend; using fileapi::FileSystemOperation; using fileapi::FileSystemURL; using fileapi::FileUpdateObserver; diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index cd97acb..7bd9337 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -127,7 +127,7 @@ #include "ppapi/shared_impl/ppapi_switches.h" #include "ui/base/ui_base_switches.h" #include "ui/gl/gl_switches.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/glue/resource_type.h" #include "webkit/plugins/plugin_switches.h" diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index 3d38520..0e39438 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -49,7 +49,7 @@ #include "net/url_request/url_request_context_getter.h" #include "ui/base/ui_base_switches.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/glue/resource_type.h" #if defined(OS_WIN) diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 0dbc058..d37ca09 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -480,10 +480,10 @@ '../webkit/browser/fileapi/sandbox_database_test_helper.cc', '../webkit/browser/fileapi/sandbox_database_test_helper.h', '../webkit/browser/fileapi/sandbox_directory_database_unittest.cc', + '../webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc', '../webkit/browser/fileapi/sandbox_file_system_test_helper.cc', '../webkit/browser/fileapi/sandbox_file_system_test_helper.h', '../webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc', - '../webkit/browser/fileapi/sandbox_mount_point_provider_unittest.cc', '../webkit/browser/fileapi/sandbox_origin_database_unittest.cc', '../webkit/browser/fileapi/syncable/canned_syncable_file_system.cc', '../webkit/browser/fileapi/syncable/canned_syncable_file_system.h', diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 29c8a28..f7a4d20 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -68,7 +68,7 @@ class SelectFilePolicy; namespace fileapi { class ExternalMountPoints; -class FileSystemMountPointProvider; +class FileSystemBackend; } namespace quota { @@ -561,19 +561,16 @@ class CONTENT_EXPORT ContentBrowserClient { virtual void GetAdditionalAllowedSchemesForFileSystem( std::vector<std::string>* additional_schemes) {} - // Returns additional MountPointProviders for FileSystem API. + // Returns additional file system backends for FileSystem API. // |special_storage_policy| and |external_mount_points| are needed in the - // additional MountPointProviders. |special_storage_policy| is used to grant + // additional FileSystemBackends. |special_storage_policy| is used to grant // permissions. |external_mount_points| has mount points to create objects - // returned by additional MountPointProviders. (Note: although it is named - // "provider", it acts creating objects based on mount points provided by - // |external_mount_points|). - virtual void GetAdditionalFileSystemMountPointProviders( + // returned by additional FileSystemBackends. + virtual void GetAdditionalFileSystemBackends( const base::FilePath& storage_partition_path, quota::SpecialStoragePolicy* special_storage_policy, fileapi::ExternalMountPoints* external_mount_points, - ScopedVector<fileapi::FileSystemMountPointProvider>* - additional_providers) {} + ScopedVector<fileapi::FileSystemBackend>* additional_backends) {} // Allows an embedder to return its own LocationProvider implementation. // Return NULL to use the default one for the platform to be created. diff --git a/tools/valgrind/memcheck/suppressions.txt b/tools/valgrind/memcheck/suppressions.txt index 31c59e1..cdd26fe 100644 --- a/tools/valgrind/memcheck/suppressions.txt +++ b/tools/valgrind/memcheck/suppressions.txt @@ -7064,7 +7064,7 @@ bug_243753 Memcheck:Leak fun:_Znw* - fun:_ZN7fileapi29SandboxMountPointProviderTest11GetRootPathERK4GURLNS_14FileSystemTypeEbPN4base8FilePathE + fun:_ZN7fileapi28SandboxFileSystemBackendTest11GetRootPathERK4GURLNS_14FileSystemTypeEbPN4base8FilePathE } { bug_245714 @@ -7152,8 +7152,8 @@ bug_247525a Memcheck:Leak fun:_Znw* - fun:_ZN7fileapi25SandboxMountPointProviderC1EPN5quota17QuotaManagerProxyEPN4base19SequencedTaskRunnerERKNS4_8FilePathERKNS_17FileSystemOptionsEPNS1_20SpecialStoragePolicyE - fun:_ZN7fileapi17FileSystemContextC1E10scoped_ptrINS_21FileSystemTaskRunnersEN4base14DefaultDeleterIS2_EEEPNS_19ExternalMountPointsEPN5quota20SpecialStoragePolicyEPNS9_17QuotaManagerProxyE12ScopedVectorINS_28FileSystemMountPointProviderEERKNS3_8FilePathERKNS_17FileSystemOptionsE + fun:_ZN7fileapi24SandboxFileSystemBackendC1EPN5quota17QuotaManagerProxyEPN4base19SequencedTaskRunnerERKNS4_8FilePathERKNS_17FileSystemOptionsEPNS1_20SpecialStoragePolicyE + fun:_ZN7fileapi17FileSystemContextC1E10scoped_ptrINS_21FileSystemTaskRunnersEN4base14DefaultDeleterIS2_EEEPNS_19ExternalMountPointsEPN5quota20SpecialStoragePolicyEPNS9_17QuotaManagerProxyE12ScopedVectorINS_17FileSystemBackendEERKNS3_8FilePathERKNS_17FileSystemOptionsE fun:_ZN7content23CreateFileSystemContextERKN4base8FilePathEbPN7fileapi19ExternalMountPointsEPN5quota20SpecialStoragePolicyEPNS7_17QuotaManagerProxyE fun:_ZN7content20StoragePartitionImpl6CreateEPNS_14BrowserContextEbRKN4base8FilePathE fun:_ZN7content23StoragePartitionImplMap3GetERKSsS2_b diff --git a/webkit/browser/fileapi/async_file_test_helper.cc b/webkit/browser/fileapi/async_file_test_helper.cc index 476fdcd..8a01fd2 100644 --- a/webkit/browser/fileapi/async_file_test_helper.cc +++ b/webkit/browser/fileapi/async_file_test_helper.cc @@ -6,8 +6,8 @@ #include "base/run_loop.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/async_file_test_helper.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/quota/quota_manager.h" diff --git a/webkit/browser/fileapi/async_file_util.h b/webkit/browser/fileapi/async_file_util.h index fd399a5..9d51024 100644 --- a/webkit/browser/fileapi/async_file_util.h +++ b/webkit/browser/fileapi/async_file_util.h @@ -33,7 +33,7 @@ class FileSystemURL; // must implement this interface or a synchronous version of interface: // FileSystemFileUtil. // -// As far as an instance of this class is owned by a MountPointProvider +// As far as an instance of this class is owned by a FileSystemBackend // (which is owned by FileSystemContext), it's guaranteed that this instance's // alive while FileSystemOperationContext given to each operation is kept // alive. (Note that this instance might be freed on different thread diff --git a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc index b971fd5..51dbe77 100644 --- a/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc +++ b/webkit/browser/fileapi/copy_or_move_file_validator_unittest.cc @@ -11,12 +11,12 @@ #include "webkit/browser/fileapi/async_file_test_helper.h" #include "webkit/browser/fileapi/copy_or_move_file_validator.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/isolated_context.h" #include "webkit/browser/fileapi/mock_file_system_context.h" -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include "webkit/browser/quota/mock_special_storage_policy.h" #include "webkit/common/fileapi/file_system_util.h" @@ -52,16 +52,16 @@ class CopyOrMoveFileValidatorTestHelper { file_system_context_ = CreateFileSystemContextForTesting(NULL, base_dir); - // Set up TestMountPointProvider to require CopyOrMoveFileValidator. - FileSystemMountPointProvider* test_mount_point_provider = - file_system_context_->GetMountPointProvider(kWithValidatorType); - static_cast<TestMountPointProvider*>(test_mount_point_provider)-> + // Set up TestFileSystemBackend to require CopyOrMoveFileValidator. + FileSystemBackend* test_file_system_backend = + file_system_context_->GetFileSystemBackend(kWithValidatorType); + static_cast<TestFileSystemBackend*>(test_file_system_backend)-> set_require_copy_or_move_validator(true); // Sets up source. - FileSystemMountPointProvider* src_mount_point_provider = - file_system_context_->GetMountPointProvider(src_type_); - src_mount_point_provider->OpenFileSystem( + FileSystemBackend* src_file_system_backend = + file_system_context_->GetFileSystemBackend(src_type_); + src_file_system_backend->OpenFileSystem( origin_, src_type_, OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::Bind(&ExpectOk)); @@ -88,9 +88,9 @@ class CopyOrMoveFileValidatorTestHelper { void SetMediaCopyOrMoveFileValidatorFactory( scoped_ptr<CopyOrMoveFileValidatorFactory> factory) { - TestMountPointProvider* provider = static_cast<TestMountPointProvider*>( - file_system_context_->GetMountPointProvider(kWithValidatorType)); - provider->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); + TestFileSystemBackend* backend = static_cast<TestFileSystemBackend*>( + file_system_context_->GetFileSystemBackend(kWithValidatorType)); + backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); } void CopyTest(base::PlatformFileError expected) { diff --git a/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc index fd02874..bda8ce0 100644 --- a/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc +++ b/webkit/browser/fileapi/copy_or_move_operation_delegate_unittest.cc @@ -13,8 +13,8 @@ #include "base/stl_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/async_file_test_helper.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/mock_file_system_context.h" @@ -68,14 +68,14 @@ class CopyOrMoveOperationTestHelper { CreateFileSystemContextForTesting(quota_manager_proxy_.get(), base_dir); // Prepare the origin's root directory. - FileSystemMountPointProvider* mount_point_provider = - file_system_context_->GetMountPointProvider(src_type_); + FileSystemBackend* mount_point_provider = + file_system_context_->GetFileSystemBackend(src_type_); mount_point_provider->OpenFileSystem( origin_, src_type_, OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, base::Bind(&ExpectOk)); mount_point_provider = - file_system_context_->GetMountPointProvider(dest_type_); + file_system_context_->GetFileSystemBackend(dest_type_); mount_point_provider->OpenFileSystem( origin_, dest_type_, OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, diff --git a/webkit/browser/fileapi/dump_file_system.cc b/webkit/browser/fileapi/dump_file_system.cc index 42fb86a..1c165d7 100644 --- a/webkit/browser/fileapi/dump_file_system.cc +++ b/webkit/browser/fileapi/dump_file_system.cc @@ -40,7 +40,7 @@ #include "base/strings/stringprintf.h" #include "webkit/browser/fileapi/obfuscated_file_util.h" #include "webkit/browser/fileapi/sandbox_directory_database.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/sandbox_origin_database.h" #include "webkit/common/fileapi/file_system_types.h" #include "webkit/common/fileapi/file_system_util.h" diff --git a/webkit/browser/fileapi/file_system_mount_point_provider.h b/webkit/browser/fileapi/file_system_backend.h index 3de8793..03f2766 100644 --- a/webkit/browser/fileapi/file_system_mount_point_provider.h +++ b/webkit/browser/fileapi/file_system_backend.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ -#define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ +#ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ +#define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ #include <string> #include <vector> @@ -35,18 +35,17 @@ class FileSystemOperation; class FileSystemQuotaUtil; class RemoteFileSystemProxyInterface; -// An interface to provide mount-point-specific path-related utilities -// and specialized FileSystemFileUtil instance. +// An interface for defining a file system backend. // -// NOTE: when you implement a new MountPointProvider for your own +// NOTE: when you implement a new FileSystemBackend for your own // FileSystem module, please contact to kinuko@chromium.org. // -class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemMountPointProvider { +class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemBackend { public: // Callback for OpenFileSystem. typedef base::Callback<void(base::PlatformFileError error)> OpenFileSystemCallback; - virtual ~FileSystemMountPointProvider() {} + virtual ~FileSystemBackend() {} // Returns true if this mount point provider can handle |type|. // One mount point provider may be able to handle multiple filesystem types. @@ -118,8 +117,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemMountPointProvider { }; // An interface to control external file system access permissions. -class ExternalFileSystemMountPointProvider - : public FileSystemMountPointProvider { +// TODO(satorux): Move this out of 'webkit/browser/fileapi'. crbug.com/257279 +class ExternalFileSystemBackend : public FileSystemBackend { public: // Returns true if |url| is allowed to be accessed. // This is supposed to perform ExternalFileSystem-specific security @@ -147,4 +146,4 @@ class ExternalFileSystemMountPointProvider } // namespace fileapi -#endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_ +#endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_BACKEND_H_ diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc index b552522..49f6388 100644 --- a/webkit/browser/fileapi/file_system_context.cc +++ b/webkit/browser/fileapi/file_system_context.cc @@ -22,13 +22,13 @@ #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/isolated_context.h" -#include "webkit/browser/fileapi/isolated_mount_point_provider.h" +#include "webkit/browser/fileapi/isolated_file_system_backend.h" #include "webkit/browser/fileapi/mount_points.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h" #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include "webkit/browser/quota/quota_manager.h" #include "webkit/browser/quota/special_storage_policy.h" #include "webkit/common/fileapi/file_system_util.h" @@ -105,20 +105,20 @@ FileSystemContext::FileSystemContext( ExternalMountPoints* external_mount_points, quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, - ScopedVector<FileSystemMountPointProvider> additional_providers, + ScopedVector<FileSystemBackend> additional_backends, const base::FilePath& partition_path, const FileSystemOptions& options) : task_runners_(task_runners.Pass()), quota_manager_proxy_(quota_manager_proxy), - sandbox_provider_( - new SandboxMountPointProvider( + sandbox_backend_( + new SandboxFileSystemBackend( quota_manager_proxy, task_runners_->file_task_runner(), partition_path, options, special_storage_policy)), - isolated_provider_(new IsolatedMountPointProvider()), - additional_providers_(additional_providers.Pass()), + isolated_backend_(new IsolatedFileSystemBackend()), + additional_backends_(additional_backends.Pass()), external_mount_points_(external_mount_points), partition_path_(partition_path), operation_runner_(new FileSystemOperationRunner(this)) { @@ -129,13 +129,13 @@ FileSystemContext::FileSystemContext( this, options.is_incognito())); } - RegisterMountPointProvider(sandbox_provider_.get()); - RegisterMountPointProvider(isolated_provider_.get()); + RegisterBackend(sandbox_backend_.get()); + RegisterBackend(isolated_backend_.get()); - for (ScopedVector<FileSystemMountPointProvider>::const_iterator iter = - additional_providers_.begin(); - iter != additional_providers_.end(); ++iter) { - RegisterMountPointProvider(*iter); + for (ScopedVector<FileSystemBackend>::const_iterator iter = + additional_backends_.begin(); + iter != additional_backends_.end(); ++iter) { + RegisterBackend(*iter); } // Additional mount points must be added before regular system-wide @@ -152,13 +152,13 @@ bool FileSystemContext::DeleteDataForOriginOnFileThread( DCHECK(origin_url == origin_url.GetOrigin()); bool success = true; - for (MountPointProviderMap::iterator iter = provider_map_.begin(); - iter != provider_map_.end(); + for (FileSystemBackendMap::iterator iter = backend_map_.begin(); + iter != backend_map_.end(); ++iter) { - FileSystemMountPointProvider* provider = iter->second; - if (!provider->GetQuotaUtil()) + FileSystemBackend* backend = iter->second; + if (!backend->GetQuotaUtil()) continue; - if (provider->GetQuotaUtil()->DeleteOriginDataOnFileThread( + if (backend->GetQuotaUtil()->DeleteOriginDataOnFileThread( this, quota_manager_proxy(), origin_url, iter->first) != base::PLATFORM_FILE_OK) { // Continue the loop, but record the failure. @@ -171,29 +171,26 @@ bool FileSystemContext::DeleteDataForOriginOnFileThread( FileSystemQuotaUtil* FileSystemContext::GetQuotaUtil(FileSystemType type) const { - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) return NULL; - return mount_point_provider->GetQuotaUtil(); + return backend->GetQuotaUtil(); } AsyncFileUtil* FileSystemContext::GetAsyncFileUtil( FileSystemType type) const { - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) return NULL; - return mount_point_provider->GetAsyncFileUtil(type); + return backend->GetAsyncFileUtil(type); } FileSystemFileUtil* FileSystemContext::GetFileUtil( FileSystemType type) const { - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) return NULL; - return mount_point_provider->GetFileUtil(type); + return backend->GetFileUtil(type); } CopyOrMoveFileValidatorFactory* @@ -201,18 +198,17 @@ FileSystemContext::GetCopyOrMoveFileValidatorFactory( FileSystemType type, base::PlatformFileError* error_code) const { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) return NULL; - return mount_point_provider->GetCopyOrMoveFileValidatorFactory( + return backend->GetCopyOrMoveFileValidatorFactory( type, error_code); } -FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider( +FileSystemBackend* FileSystemContext::GetFileSystemBackend( FileSystemType type) const { - MountPointProviderMap::const_iterator found = provider_map_.find(type); - if (found != provider_map_.end()) + FileSystemBackendMap::const_iterator found = backend_map_.find(type); + if (found != backend_map_.end()) return found->second; NOTREACHED() << "Unknown filesystem type: " << type; return NULL; @@ -224,41 +220,40 @@ bool FileSystemContext::IsSandboxFileSystem(FileSystemType type) const { const UpdateObserverList* FileSystemContext::GetUpdateObservers( FileSystemType type) const { - // Currently update observer is only available in SandboxMountPointProvider - // and TestMountPointProvider. + // Currently update observer is only available in SandboxFileSystemBackend + // and TestFileSystemBackend. // TODO(kinuko): Probably GetUpdateObservers() virtual method should be - // added to FileSystemMountPointProvider interface and be called like + // added to FileSystemBackend interface and be called like // other GetFoo() methods do. - if (sandbox_provider_->CanHandleType(type)) - return sandbox_provider_->GetUpdateObservers(type); + if (sandbox_backend_->CanHandleType(type)) + return sandbox_backend_->GetUpdateObservers(type); if (type != kFileSystemTypeTest) return NULL; - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - return static_cast<TestMountPointProvider*>( - mount_point_provider)->GetUpdateObservers(type); + FileSystemBackend* backend = GetFileSystemBackend(type); + return static_cast<TestFileSystemBackend*>( + backend)->GetUpdateObservers(type); } const AccessObserverList* FileSystemContext::GetAccessObservers( FileSystemType type) const { - // Currently access observer is only available in SandboxMountPointProvider. - if (sandbox_provider_->CanHandleType(type)) - return sandbox_provider_->GetAccessObservers(type); + // Currently access observer is only available in SandboxFileSystemBackend. + if (sandbox_backend_->CanHandleType(type)) + return sandbox_backend_->GetAccessObservers(type); return NULL; } void FileSystemContext::GetFileSystemTypes( std::vector<FileSystemType>* types) const { types->clear(); - for (MountPointProviderMap::const_iterator iter = provider_map_.begin(); - iter != provider_map_.end(); ++iter) + for (FileSystemBackendMap::const_iterator iter = backend_map_.begin(); + iter != backend_map_.end(); ++iter) types->push_back(iter->first); } -ExternalFileSystemMountPointProvider* -FileSystemContext::external_provider() const { - return static_cast<ExternalFileSystemMountPointProvider*>( - GetMountPointProvider(kFileSystemTypeExternal)); +ExternalFileSystemBackend* +FileSystemContext::external_backend() const { + return static_cast<ExternalFileSystemBackend*>( + GetFileSystemBackend(kFileSystemTypeExternal)); } void FileSystemContext::OpenFileSystem( @@ -268,9 +263,8 @@ void FileSystemContext::OpenFileSystem( const OpenFileSystemCallback& callback) { DCHECK(!callback.is_null()); - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) { + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) { callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); return; } @@ -282,7 +276,7 @@ void FileSystemContext::OpenFileSystem( root_url = GetFileSystemRootURI(origin_url, type); std::string name = GetFileSystemName(origin_url, type); - mount_point_provider->OpenFileSystem( + backend->OpenFileSystem( origin_url, type, mode, base::Bind(&DidOpenFileSystem, callback, root_url, name)); } @@ -292,13 +286,12 @@ void FileSystemContext::DeleteFileSystem( FileSystemType type, const DeleteFileSystemCallback& callback) { DCHECK(origin_url == origin_url.GetOrigin()); - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(type); - if (!mount_point_provider) { + FileSystemBackend* backend = GetFileSystemBackend(type); + if (!backend) { callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); return; } - if (!mount_point_provider->GetQuotaUtil()) { + if (!backend->GetQuotaUtil()) { callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); return; } @@ -308,7 +301,7 @@ void FileSystemContext::DeleteFileSystem( FROM_HERE, // It is safe to pass Unretained(quota_util) since context owns it. base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileThread, - base::Unretained(mount_point_provider->GetQuotaUtil()), + base::Unretained(backend->GetQuotaUtil()), make_scoped_refptr(this), base::Unretained(quota_manager_proxy()), origin_url, @@ -323,11 +316,10 @@ FileSystemContext::CreateFileStreamReader( const base::Time& expected_modification_time) { if (!url.is_valid()) return scoped_ptr<webkit_blob::FileStreamReader>(); - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(url.type()); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(url.type()); + if (!backend) return scoped_ptr<webkit_blob::FileStreamReader>(); - return mount_point_provider->CreateFileStreamReader( + return backend->CreateFileStreamReader( url, offset, expected_modification_time, this); } @@ -336,11 +328,10 @@ scoped_ptr<FileStreamWriter> FileSystemContext::CreateFileStreamWriter( int64 offset) { if (!url.is_valid()) return scoped_ptr<FileStreamWriter>(); - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(url.type()); - if (!mount_point_provider) + FileSystemBackend* backend = GetFileSystemBackend(url.type()); + if (!backend) return scoped_ptr<FileStreamWriter>(); - return mount_point_provider->CreateFileStreamWriter(url, offset, this); + return backend->CreateFileStreamWriter(url, offset, this); } void FileSystemContext::SetLocalFileChangeTracker( @@ -348,11 +339,11 @@ void FileSystemContext::SetLocalFileChangeTracker( DCHECK(!change_tracker_.get()); DCHECK(tracker.get()); change_tracker_ = tracker.Pass(); - sandbox_provider_->AddFileUpdateObserver( + sandbox_backend_->AddFileUpdateObserver( kFileSystemTypeSyncable, change_tracker_.get(), task_runners_->file_task_runner()); - sandbox_provider_->AddFileChangeObserver( + sandbox_backend_->AddFileChangeObserver( kFileSystemTypeSyncable, change_tracker_.get(), task_runners_->file_task_runner()); @@ -376,7 +367,7 @@ FileSystemURL FileSystemContext::CreateCrackedFileSystemURL( #if defined(OS_CHROMEOS) && defined(GOOGLE_CHROME_BUILD) void FileSystemContext::EnableTemporaryFileSystemInIncognito() { - sandbox_provider_->set_enable_temporary_file_system_in_incognito(true); + sandbox_backend_->set_enable_temporary_file_system_in_incognito(true); } #endif @@ -401,9 +392,8 @@ FileSystemOperation* FileSystemContext::CreateFileSystemOperation( return NULL; } - FileSystemMountPointProvider* mount_point_provider = - GetMountPointProvider(url.type()); - if (!mount_point_provider) { + FileSystemBackend* backend = GetFileSystemBackend(url.type()); + if (!backend) { if (error_code) *error_code = base::PLATFORM_FILE_ERROR_FAILED; return NULL; @@ -411,7 +401,7 @@ FileSystemOperation* FileSystemContext::CreateFileSystemOperation( base::PlatformFileError fs_error = base::PLATFORM_FILE_OK; FileSystemOperation* operation = - mount_point_provider->CreateFileSystemOperation(url, this, &fs_error); + backend->CreateFileSystemOperation(url, this, &fs_error); if (error_code) *error_code = fs_error; @@ -446,29 +436,29 @@ FileSystemURL FileSystemContext::CrackFileSystemURL( return current; } -void FileSystemContext::RegisterMountPointProvider( - FileSystemMountPointProvider* provider) { +void FileSystemContext::RegisterBackend( + FileSystemBackend* backend) { const FileSystemType mount_types[] = { kFileSystemTypeTemporary, kFileSystemTypePersistent, kFileSystemTypeIsolated, kFileSystemTypeExternal, }; - // Register mount point providers for public mount types. + // Register file system backends for public mount types. for (size_t j = 0; j < ARRAYSIZE_UNSAFE(mount_types); ++j) { - if (provider->CanHandleType(mount_types[j])) { - const bool inserted = provider_map_.insert( - std::make_pair(mount_types[j], provider)).second; + if (backend->CanHandleType(mount_types[j])) { + const bool inserted = backend_map_.insert( + std::make_pair(mount_types[j], backend)).second; DCHECK(inserted); } } - // Register mount point providers for internal types. + // Register file system backends for internal types. for (int t = kFileSystemInternalTypeEnumStart + 1; t < kFileSystemInternalTypeEnumEnd; ++t) { FileSystemType type = static_cast<FileSystemType>(t); - if (provider->CanHandleType(type)) { - const bool inserted = provider_map_.insert( - std::make_pair(type, provider)).second; + if (backend->CanHandleType(type)) { + const bool inserted = backend_map_.insert( + std::make_pair(type, backend)).second; DCHECK(inserted); } } diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h index 21d48be..be293b9 100644 --- a/webkit/browser/fileapi/file_system_context.h +++ b/webkit/browser/fileapi/file_system_context.h @@ -48,20 +48,20 @@ namespace fileapi { class AsyncFileUtil; class CopyOrMoveFileValidatorFactory; -class ExternalFileSystemMountPointProvider; +class ExternalFileSystemBackend; class ExternalMountPoints; class FileStreamWriter; class FileSystemFileUtil; -class FileSystemMountPointProvider; +class FileSystemBackend; class FileSystemOperation; class FileSystemOperationRunner; class FileSystemOptions; class FileSystemQuotaUtil; class FileSystemTaskRunners; class FileSystemURL; -class IsolatedMountPointProvider; +class IsolatedFileSystemBackend; class MountPoints; -class SandboxMountPointProvider; +class SandboxFileSystemBackend; struct DefaultContextDeleter; @@ -80,7 +80,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext static int GetPermissionPolicy(FileSystemType type); // task_runners->file_task_runner() is used as default TaskRunner. - // Unless a MountPointProvider is overridden in CreateFileSystemOperation, + // Unless a FileSystemBackend is overridden in CreateFileSystemOperation, // it is used for all file operations and file related meta operations. // The code assumes that // task_runners->file_task_runner()->RunsTasksOnCurrentThread() @@ -88,12 +88,11 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // blocking file operations (like SequencedWorkerPool implementation does). // // |external_mount_points| contains non-system external mount points available - // in the context. If not NULL, it will be used during URL cracking. On - // ChromeOS, it will be passed to external_mount_point_provider. + // in the context. If not NULL, it will be used during URL cracking. // |external_mount_points| may be NULL only on platforms different from // ChromeOS (i.e. platforms that don't use external_mount_point_provider). // - // |additional_providers| are added to the internal provider map + // |additional_backends| are added to the internal backend map // to serve filesystem requests for non-regular types. // If none is given, this context only handles HTML5 Sandbox FileSystem // and Drag-and-drop Isolated FileSystem requests. @@ -102,7 +101,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext ExternalMountPoints* external_mount_points, quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, - ScopedVector<FileSystemMountPointProvider> additional_providers, + ScopedVector<FileSystemBackend> additional_backends, const base::FilePath& partition_path, const FileSystemOptions& options); @@ -131,10 +130,10 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( FileSystemType type, base::PlatformFileError* error_code) const; - // Returns the mount point provider instance for the given |type|. + // Returns the file system backend instance for the given |type|. // This may return NULL if it is given an invalid or unsupported filesystem // type. - FileSystemMountPointProvider* GetMountPointProvider( + FileSystemBackend* GetFileSystemBackend( FileSystemType type) const; // Returns true for sandboxed filesystems. Currently this does @@ -150,10 +149,10 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // Returns all registered filesystem types. void GetFileSystemTypes(std::vector<FileSystemType>* types) const; - // Returns a FileSystemMountPointProvider instance for external filesystem + // Returns a FileSystemBackend instance for external filesystem // type, which is used only by chromeos for now. This is equivalent to - // calling GetMountPointProvider(kFileSystemTypeExternal). - ExternalFileSystemMountPointProvider* external_provider() const; + // calling GetFileSystemBackend(kFileSystemTypeExternal). + ExternalFileSystemBackend* external_backend() const; // Used for OpenFileSystem. typedef base::Callback<void(base::PlatformFileError result, @@ -189,8 +188,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // the file has been modified, and if it does any succeeding read operations // should fail with ERR_UPLOAD_FILE_CHANGED error. // This method internally cracks the |url|, get an appropriate - // MountPointProvider for the URL and call the provider's CreateFileReader. - // The resolved MountPointProvider could perform further specialization + // FileSystemBackend for the URL and call the backend's CreateFileReader. + // The resolved FileSystemBackend could perform further specialization // depending on the filesystem type pointed by the |url|. scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( const FileSystemURL& url, @@ -236,13 +235,13 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext #endif private: - typedef std::map<FileSystemType, FileSystemMountPointProvider*> - MountPointProviderMap; + typedef std::map<FileSystemType, FileSystemBackend*> + FileSystemBackendMap; // For CreateFileSystemOperation. friend class FileSystemOperationRunner; - // For sandbox_provider(). + // For sandbox_backend(). friend class SandboxFileSystemTestHelper; // Deleters. @@ -255,9 +254,9 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext void DeleteOnCorrectThread() const; // Creates a new FileSystemOperation instance by getting an appropriate - // MountPointProvider for |url| and calling the provider's corresponding + // FileSystemBackend for |url| and calling the backend's corresponding // CreateFileSystemOperation method. - // The resolved MountPointProvider could perform further specialization + // The resolved FileSystemBackend could perform further specialization // depending on the filesystem type pointed by the |url|. // // Called by FileSystemOperationRunner. @@ -274,33 +273,33 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // returns the original url, without attempting to crack it. FileSystemURL CrackFileSystemURL(const FileSystemURL& url) const; - // For initial provider_map construction. This must be called only from + // For initial backend_map construction. This must be called only from // the constructor. - void RegisterMountPointProvider(FileSystemMountPointProvider* provider); + void RegisterBackend(FileSystemBackend* backend); - // Returns a FileSystemMountPointProvider, used only by test code. - SandboxMountPointProvider* sandbox_provider() const { - return sandbox_provider_.get(); + // Returns a FileSystemBackend, used only by test code. + SandboxFileSystemBackend* sandbox_backend() const { + return sandbox_backend_.get(); } scoped_ptr<FileSystemTaskRunners> task_runners_; scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; - // Regular mount point providers. - scoped_ptr<SandboxMountPointProvider> sandbox_provider_; - scoped_ptr<IsolatedMountPointProvider> isolated_provider_; + // Regular file system backends. + scoped_ptr<SandboxFileSystemBackend> sandbox_backend_; + scoped_ptr<IsolatedFileSystemBackend> isolated_backend_; - // Additional mount point providers. - ScopedVector<FileSystemMountPointProvider> additional_providers_; + // Additional file system backends. + ScopedVector<FileSystemBackend> additional_backends_; - // Registered mount point providers. + // Registered file system backends. // The map must be constructed in the constructor since it can be accessed // on multiple threads. - // This map itself doesn't retain each provider's ownership; ownerships - // of the providers are held by additional_providers_ or other scoped_ptr - // provider fields. - MountPointProviderMap provider_map_; + // This map itself doesn't retain each backend's ownership; ownerships + // of the backends are held by additional_backends_ or other scoped_ptr + // backend fields. + FileSystemBackendMap backend_map_; // External mount points visible in the file system context (excluding system // external mount points). diff --git a/webkit/browser/fileapi/file_system_context_unittest.cc b/webkit/browser/fileapi/file_system_context_unittest.cc index 3c5dfcb..a2beb07a 100644 --- a/webkit/browser/fileapi/file_system_context_unittest.cc +++ b/webkit/browser/fileapi/file_system_context_unittest.cc @@ -9,7 +9,7 @@ #include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/external_mount_points.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/isolated_context.h" #include "webkit/browser/fileapi/mock_file_system_options.h" @@ -64,7 +64,7 @@ class FileSystemContextTest : public testing::Test { external_mount_points, storage_policy_.get(), mock_quota_manager_->proxy(), - ScopedVector<FileSystemMountPointProvider>(), + ScopedVector<FileSystemBackend>(), data_dir_.path(), CreateAllowFileAccessOptions()); } diff --git a/webkit/browser/fileapi/file_system_quota_client.cc b/webkit/browser/fileapi/file_system_quota_client.cc index 571a08d..9e72e98 100644 --- a/webkit/browser/fileapi/file_system_quota_client.cc +++ b/webkit/browser/fileapi/file_system_quota_client.cc @@ -22,7 +22,7 @@ #include "webkit/browser/fileapi/file_system_quota_util.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_usage_cache.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/common/fileapi/file_system_util.h" using quota::StorageType; @@ -68,7 +68,7 @@ quota::QuotaStatusCode DeleteOriginOnFileThread( FileSystemContext* context, const GURL& origin, FileSystemType type) { - FileSystemMountPointProvider* provider = context->GetMountPointProvider(type); + FileSystemBackend* provider = context->GetFileSystemBackend(type); if (!provider || !provider->GetQuotaUtil()) return quota::kQuotaErrorNotSupported; base::PlatformFileError result = diff --git a/webkit/browser/fileapi/isolated_mount_point_provider.cc b/webkit/browser/fileapi/isolated_file_system_backend.cc index 362c528..d40fe36 100644 --- a/webkit/browser/fileapi/isolated_mount_point_provider.cc +++ b/webkit/browser/fileapi/isolated_file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/browser/fileapi/isolated_mount_point_provider.h" +#include "webkit/browser/fileapi/isolated_file_system_backend.h" #include <string> @@ -31,16 +31,16 @@ namespace fileapi { -IsolatedMountPointProvider::IsolatedMountPointProvider() +IsolatedFileSystemBackend::IsolatedFileSystemBackend() : isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), dragged_file_util_(new AsyncFileUtilAdapter(new DraggedFileUtil())), transient_file_util_(new AsyncFileUtilAdapter(new TransientFileUtil())) { } -IsolatedMountPointProvider::~IsolatedMountPointProvider() { +IsolatedFileSystemBackend::~IsolatedFileSystemBackend() { } -bool IsolatedMountPointProvider::CanHandleType(FileSystemType type) const { +bool IsolatedFileSystemBackend::CanHandleType(FileSystemType type) const { switch (type) { case kFileSystemTypeIsolated: case kFileSystemTypeDragged: @@ -56,7 +56,7 @@ bool IsolatedMountPointProvider::CanHandleType(FileSystemType type) const { } } -void IsolatedMountPointProvider::OpenFileSystem( +void IsolatedFileSystemBackend::OpenFileSystem( const GURL& origin_url, FileSystemType type, OpenFileSystemMode mode, @@ -67,7 +67,7 @@ void IsolatedMountPointProvider::OpenFileSystem( base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); } -FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( +FileSystemFileUtil* IsolatedFileSystemBackend::GetFileUtil( FileSystemType type) { switch (type) { case kFileSystemTypeNativeLocal: @@ -82,7 +82,7 @@ FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil( return NULL; } -AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil( +AsyncFileUtil* IsolatedFileSystemBackend::GetAsyncFileUtil( FileSystemType type) { switch (type) { case kFileSystemTypeNativeLocal: @@ -98,14 +98,14 @@ AsyncFileUtil* IsolatedMountPointProvider::GetAsyncFileUtil( } CopyOrMoveFileValidatorFactory* -IsolatedMountPointProvider::GetCopyOrMoveFileValidatorFactory( +IsolatedFileSystemBackend::GetCopyOrMoveFileValidatorFactory( FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; return NULL; } -FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( +FileSystemOperation* IsolatedFileSystemBackend::CreateFileSystemOperation( const FileSystemURL& url, FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -114,7 +114,7 @@ FileSystemOperation* IsolatedMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -IsolatedMountPointProvider::CreateFileStreamReader( +IsolatedFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -125,7 +125,7 @@ IsolatedMountPointProvider::CreateFileStreamReader( url.path(), offset, expected_modification_time)); } -scoped_ptr<FileStreamWriter> IsolatedMountPointProvider::CreateFileStreamWriter( +scoped_ptr<FileStreamWriter> IsolatedFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, int64 offset, FileSystemContext* context) const { @@ -133,7 +133,7 @@ scoped_ptr<FileStreamWriter> IsolatedMountPointProvider::CreateFileStreamWriter( context->task_runners()->file_task_runner(), url.path(), offset)); } -FileSystemQuotaUtil* IsolatedMountPointProvider::GetQuotaUtil() { +FileSystemQuotaUtil* IsolatedFileSystemBackend::GetQuotaUtil() { // No quota support. return NULL; } diff --git a/webkit/browser/fileapi/isolated_mount_point_provider.h b/webkit/browser/fileapi/isolated_file_system_backend.h index 449ecf5..6d869cf 100644 --- a/webkit/browser/fileapi/isolated_mount_point_provider.h +++ b/webkit/browser/fileapi/isolated_file_system_backend.h @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_BROWSER_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ -#define WEBKIT_BROWSER_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ +#ifndef WEBKIT_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_ +#define WEBKIT_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_ #include "base/memory/scoped_ptr.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" namespace fileapi { class AsyncFileUtilAdapter; -class IsolatedMountPointProvider : public FileSystemMountPointProvider { +class IsolatedFileSystemBackend : public FileSystemBackend { public: - IsolatedMountPointProvider(); - virtual ~IsolatedMountPointProvider(); + IsolatedFileSystemBackend(); + virtual ~IsolatedFileSystemBackend(); - // FileSystemMountPointProvider implementation. + // FileSystemBackend implementation. virtual bool CanHandleType(FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -52,4 +52,4 @@ class IsolatedMountPointProvider : public FileSystemMountPointProvider { } // namespace fileapi -#endif // WEBKIT_BROWSER_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ +#endif // WEBKIT_BROWSER_FILEAPI_ISOLATED_FILE_SYSTEM_BACKEND_H_ diff --git a/webkit/browser/fileapi/local_file_system_operation.cc b/webkit/browser/fileapi/local_file_system_operation.cc index 7f09998..688ada6 100644 --- a/webkit/browser/fileapi/local_file_system_operation.cc +++ b/webkit/browser/fileapi/local_file_system_operation.cc @@ -13,9 +13,9 @@ #include "webkit/browser/fileapi/async_file_util.h" #include "webkit/browser/fileapi/copy_or_move_operation_delegate.h" #include "webkit/browser/fileapi/file_observers.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_file_util.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_url.h" diff --git a/webkit/browser/fileapi/local_file_system_operation.h b/webkit/browser/fileapi/local_file_system_operation.h index 044081db..0ccf33c 100644 --- a/webkit/browser/fileapi/local_file_system_operation.h +++ b/webkit/browser/fileapi/local_file_system_operation.h @@ -29,7 +29,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT LocalFileSystemOperation : public NON_EXPORTED_BASE(FileSystemOperation), public base::SupportsWeakPtr<LocalFileSystemOperation> { public: - // NOTE: This constructor should not be called outside MountPointProviders; + // NOTE: This constructor should not be called outside FileSystemBackends; // instead please consider using // file_system_context->CreateFileSystemOperation() to instantiate // an appropriate FileSystemOperation. diff --git a/webkit/browser/fileapi/local_file_system_operation_unittest.cc b/webkit/browser/fileapi/local_file_system_operation_unittest.cc index 0dfb82e..3a8a428 100644 --- a/webkit/browser/fileapi/local_file_system_operation_unittest.cc +++ b/webkit/browser/fileapi/local_file_system_operation_unittest.cc @@ -20,8 +20,8 @@ #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/mock_file_change_observer.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/sandbox_file_system_test_helper.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" #include "webkit/browser/quota/mock_quota_manager.h" #include "webkit/browser/quota/quota_manager.h" #include "webkit/common/blob/shareable_file_reference.h" diff --git a/webkit/browser/fileapi/local_file_system_operation_write_unittest.cc b/webkit/browser/fileapi/local_file_system_operation_write_unittest.cc index e5a879c..8219d19 100644 --- a/webkit/browser/fileapi/local_file_system_operation_write_unittest.cc +++ b/webkit/browser/fileapi/local_file_system_operation_write_unittest.cc @@ -25,7 +25,7 @@ #include "webkit/browser/fileapi/local_file_util.h" #include "webkit/browser/fileapi/mock_file_change_observer.h" #include "webkit/browser/fileapi/mock_file_system_context.h" -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include "webkit/browser/quota/mock_quota_manager.h" #include "webkit/common/blob/blob_data.h" #include "webkit/common/fileapi/file_system_util.h" @@ -80,8 +80,8 @@ class LocalFileSystemOperationWriteTest URLForPath(virtual_path_), true /* exclusive */, base::Bind(&AssertStatusEq, base::PLATFORM_FILE_OK)); - static_cast<TestMountPointProvider*>( - file_system_context_->GetMountPointProvider(kFileSystemType)) + static_cast<TestFileSystemBackend*>( + file_system_context_->GetFileSystemBackend(kFileSystemType)) ->AddFileChangeObserver(change_observer()); } diff --git a/webkit/browser/fileapi/local_file_util.h b/webkit/browser/fileapi/local_file_util.h index 5d08359..abd6b54 100644 --- a/webkit/browser/fileapi/local_file_util.h +++ b/webkit/browser/fileapi/local_file_util.h @@ -23,7 +23,7 @@ namespace fileapi { class FileSystemOperationContext; class FileSystemURL; -// An instance of this class is created and owned by *MountPointProvider. +// An instance of this class is created and owned by *FileSystemBackend. class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { public: diff --git a/webkit/browser/fileapi/mock_file_system_context.cc b/webkit/browser/fileapi/mock_file_system_context.cc index 70ddbcc..329e1a3 100644 --- a/webkit/browser/fileapi/mock_file_system_context.cc +++ b/webkit/browser/fileapi/mock_file_system_context.cc @@ -6,11 +6,11 @@ #include "base/memory/scoped_vector.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/mock_file_system_options.h" -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include "webkit/browser/quota/mock_special_storage_policy.h" namespace fileapi { @@ -18,8 +18,8 @@ namespace fileapi { FileSystemContext* CreateFileSystemContextForTesting( quota::QuotaManagerProxy* quota_manager_proxy, const base::FilePath& base_path) { - ScopedVector<FileSystemMountPointProvider> additional_providers; - additional_providers.push_back(new TestMountPointProvider( + ScopedVector<FileSystemBackend> additional_providers; + additional_providers.push_back(new TestFileSystemBackend( base::MessageLoopProxy::current().get(), base_path)); return CreateFileSystemContextWithAdditionalProvidersForTesting( quota_manager_proxy, additional_providers.Pass(), base_path); @@ -27,7 +27,7 @@ FileSystemContext* CreateFileSystemContextForTesting( FileSystemContext* CreateFileSystemContextWithAdditionalProvidersForTesting( quota::QuotaManagerProxy* quota_manager_proxy, - ScopedVector<FileSystemMountPointProvider> additional_providers, + ScopedVector<FileSystemBackend> additional_providers, const base::FilePath& base_path) { return new FileSystemContext( FileSystemTaskRunners::CreateMockTaskRunners(), diff --git a/webkit/browser/fileapi/mock_file_system_context.h b/webkit/browser/fileapi/mock_file_system_context.h index 2081ff9..bf01ba1 100644 --- a/webkit/browser/fileapi/mock_file_system_context.h +++ b/webkit/browser/fileapi/mock_file_system_context.h @@ -16,17 +16,17 @@ class SpecialStoragePolicy; namespace fileapi { class FileSystemContext; -class FileSystemMountPointProvider; +class FileSystemBackend; FileSystemContext* CreateFileSystemContextForTesting( quota::QuotaManagerProxy* quota_manager_proxy, const base::FilePath& base_path); -// The caller is responsible for including TestMountPointProvider in +// The caller is responsible for including TestFileSystemBackend in // |additional_providers| if needed. FileSystemContext* CreateFileSystemContextWithAdditionalProvidersForTesting( quota::QuotaManagerProxy* quota_manager_proxy, - ScopedVector<FileSystemMountPointProvider> additional_providers, + ScopedVector<FileSystemBackend> additional_providers, const base::FilePath& base_path); } // namespace fileapi diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc index a5e5ab3..174cb81 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.cc +++ b/webkit/browser/fileapi/obfuscated_file_util.cc @@ -24,8 +24,8 @@ #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/native_file_util.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/sandbox_isolated_origin_database.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" #include "webkit/browser/fileapi/sandbox_origin_database.h" #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" #include "webkit/browser/fileapi/timed_task_helper.h" diff --git a/webkit/browser/fileapi/obfuscated_file_util.h b/webkit/browser/fileapi/obfuscated_file_util.h index 1355ce9..4c39e52 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.h +++ b/webkit/browser/fileapi/obfuscated_file_util.h @@ -159,7 +159,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE ObfuscatedFileUtil // TODO(ericu): This doesn't really feel like it belongs in this class. // The previous version lives in FileSystemPathManager, but perhaps - // SandboxMountPointProvider would be better? + // SandboxFileSystemBackend would be better? static base::FilePath::StringType GetDirectoryNameForType( FileSystemType type); diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc index ec87a49..31e8e87 100644 --- a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc @@ -16,8 +16,8 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/fileapi/async_file_test_helper.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/file_system_usage_cache.h" diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider.cc b/webkit/browser/fileapi/sandbox_file_system_backend.cc index 89d0538..bcaa6a9 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/browser/fileapi/sandbox_file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "base/bind.h" #include "base/command_line.h" @@ -75,7 +75,7 @@ const base::FilePath::CharType kRestrictedChars[] = { }; class ObfuscatedOriginEnumerator - : public SandboxMountPointProvider::OriginEnumerator { + : public SandboxFileSystemBackend::OriginEnumerator { public: explicit ObfuscatedOriginEnumerator(ObfuscatedFileUtil* file_util) { enum_.reset(file_util->CreateOriginEnumerator()); @@ -95,8 +95,8 @@ class ObfuscatedOriginEnumerator }; void DidOpenFileSystem( - base::WeakPtr<SandboxMountPointProvider> mount_point_provider, - const FileSystemMountPointProvider::OpenFileSystemCallback& callback, + base::WeakPtr<SandboxFileSystemBackend> mount_point_provider, + const FileSystemBackend::OpenFileSystemCallback& callback, base::PlatformFileError* error) { if (mount_point_provider.get()) mount_point_provider.get()->CollectOpenFileSystemMetrics(*error); @@ -130,10 +130,10 @@ void OpenFileSystemOnFileThread( } // anonymous namespace const base::FilePath::CharType -SandboxMountPointProvider::kFileSystemDirectory[] = +SandboxFileSystemBackend::kFileSystemDirectory[] = FILE_PATH_LITERAL("File System"); -SandboxMountPointProvider::SandboxMountPointProvider( +SandboxFileSystemBackend::SandboxFileSystemBackend( quota::QuotaManagerProxy* quota_manager_proxy, base::SequencedTaskRunner* file_task_runner, const base::FilePath& profile_path, @@ -184,7 +184,7 @@ SandboxMountPointProvider::SandboxMountPointProvider( } } -SandboxMountPointProvider::~SandboxMountPointProvider() { +SandboxFileSystemBackend::~SandboxFileSystemBackend() { if (!file_task_runner_->RunsTasksOnCurrentThread()) { AsyncFileUtilAdapter* sandbox_file_util = sandbox_file_util_.release(); SandboxQuotaObserver* quota_observer = quota_observer_.release(); @@ -199,14 +199,14 @@ SandboxMountPointProvider::~SandboxMountPointProvider() { } } -bool SandboxMountPointProvider::CanHandleType(FileSystemType type) const { +bool SandboxFileSystemBackend::CanHandleType(FileSystemType type) const { return type == kFileSystemTypeTemporary || type == kFileSystemTypePersistent || type == kFileSystemTypeSyncable || type == kFileSystemTypeSyncableForInternalSync; } -void SandboxMountPointProvider::OpenFileSystem( +void SandboxFileSystemBackend::OpenFileSystem( const GURL& origin_url, fileapi::FileSystemType type, OpenFileSystemMode mode, const OpenFileSystemCallback& callback) { @@ -247,24 +247,24 @@ void SandboxMountPointProvider::OpenFileSystem( // --disable-file-system-usage-tracking. file_task_runner_->PostTask( FROM_HERE, - base::Bind(&SandboxMountPointProvider::InvalidateUsageCacheOnFileThread, + base::Bind(&SandboxFileSystemBackend::InvalidateUsageCacheOnFileThread, sandbox_sync_file_util(), origin_url, type, file_system_usage_cache_.get())); }; -FileSystemFileUtil* SandboxMountPointProvider::GetFileUtil( +FileSystemFileUtil* SandboxFileSystemBackend::GetFileUtil( FileSystemType type) { DCHECK(sandbox_file_util_.get()); return sandbox_file_util_->sync_file_util(); } -AsyncFileUtil* SandboxMountPointProvider::GetAsyncFileUtil( +AsyncFileUtil* SandboxFileSystemBackend::GetAsyncFileUtil( FileSystemType type) { return sandbox_file_util_.get(); } CopyOrMoveFileValidatorFactory* -SandboxMountPointProvider::GetCopyOrMoveFileValidatorFactory( +SandboxFileSystemBackend::GetCopyOrMoveFileValidatorFactory( FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); @@ -272,7 +272,7 @@ SandboxMountPointProvider::GetCopyOrMoveFileValidatorFactory( return NULL; } -FileSystemOperation* SandboxMountPointProvider::CreateFileSystemOperation( +FileSystemOperation* SandboxFileSystemBackend::CreateFileSystemOperation( const FileSystemURL& url, FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -307,7 +307,7 @@ FileSystemOperation* SandboxMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -SandboxMountPointProvider::CreateFileStreamReader( +SandboxFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -320,7 +320,7 @@ SandboxMountPointProvider::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -SandboxMountPointProvider::CreateFileStreamWriter( +SandboxFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, int64 offset, FileSystemContext* context) const { @@ -330,16 +330,16 @@ SandboxMountPointProvider::CreateFileStreamWriter( new SandboxFileStreamWriter(context, url, offset, update_observers_)); } -FileSystemQuotaUtil* SandboxMountPointProvider::GetQuotaUtil() { +FileSystemQuotaUtil* SandboxFileSystemBackend::GetQuotaUtil() { return this; } -SandboxMountPointProvider::OriginEnumerator* -SandboxMountPointProvider::CreateOriginEnumerator() { +SandboxFileSystemBackend::OriginEnumerator* +SandboxFileSystemBackend::CreateOriginEnumerator() { return new ObfuscatedOriginEnumerator(sandbox_sync_file_util()); } -base::FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( +base::FilePath SandboxFileSystemBackend::GetBaseDirectoryForOriginAndType( const GURL& origin_url, fileapi::FileSystemType type, bool create) { base::PlatformFileError error = base::PLATFORM_FILE_OK; @@ -351,7 +351,7 @@ base::FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( } base::PlatformFileError -SandboxMountPointProvider::DeleteOriginDataOnFileThread( +SandboxFileSystemBackend::DeleteOriginDataOnFileThread( FileSystemContext* file_system_context, QuotaManagerProxy* proxy, const GURL& origin_url, @@ -376,7 +376,7 @@ SandboxMountPointProvider::DeleteOriginDataOnFileThread( return base::PLATFORM_FILE_ERROR_FAILED; } -void SandboxMountPointProvider::GetOriginsForTypeOnFileThread( +void SandboxFileSystemBackend::GetOriginsForTypeOnFileThread( fileapi::FileSystemType type, std::set<GURL>* origins) { DCHECK(CanHandleType(type)); DCHECK(origins); @@ -401,7 +401,7 @@ void SandboxMountPointProvider::GetOriginsForTypeOnFileThread( } } -void SandboxMountPointProvider::GetOriginsForHostOnFileThread( +void SandboxFileSystemBackend::GetOriginsForHostOnFileThread( fileapi::FileSystemType type, const std::string& host, std::set<GURL>* origins) { DCHECK(CanHandleType(type)); @@ -415,7 +415,7 @@ void SandboxMountPointProvider::GetOriginsForHostOnFileThread( } } -int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( +int64 SandboxFileSystemBackend::GetOriginUsageOnFileThread( FileSystemContext* file_system_context, const GURL& origin_url, fileapi::FileSystemType type) { @@ -458,7 +458,7 @@ int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( return usage; } -void SandboxMountPointProvider::InvalidateUsageCache( +void SandboxFileSystemBackend::InvalidateUsageCache( const GURL& origin, fileapi::FileSystemType type) { DCHECK(CanHandleType(type)); @@ -470,7 +470,7 @@ void SandboxMountPointProvider::InvalidateUsageCache( file_system_usage_cache_->IncrementDirty(usage_file_path); } -void SandboxMountPointProvider::StickyInvalidateUsageCache( +void SandboxFileSystemBackend::StickyInvalidateUsageCache( const GURL& origin, fileapi::FileSystemType type) { DCHECK(CanHandleType(type)); @@ -479,7 +479,7 @@ void SandboxMountPointProvider::StickyInvalidateUsageCache( InvalidateUsageCache(origin, type); } -void SandboxMountPointProvider::CollectOpenFileSystemMetrics( +void SandboxFileSystemBackend::CollectOpenFileSystemMetrics( base::PlatformFileError error_code) { base::Time now = base::Time::Now(); bool throttled = now < next_release_time_for_open_filesystem_stat_; @@ -516,7 +516,7 @@ void SandboxMountPointProvider::CollectOpenFileSystemMetrics( #undef REPORT } -const UpdateObserverList* SandboxMountPointProvider::GetUpdateObservers( +const UpdateObserverList* SandboxFileSystemBackend::GetUpdateObservers( FileSystemType type) const { DCHECK(CanHandleType(type)); if (type == kFileSystemTypeSyncable) @@ -524,13 +524,13 @@ const UpdateObserverList* SandboxMountPointProvider::GetUpdateObservers( return &update_observers_; } -const AccessObserverList* SandboxMountPointProvider::GetAccessObservers( +const AccessObserverList* SandboxFileSystemBackend::GetAccessObservers( FileSystemType type) const { DCHECK(CanHandleType(type)); return &access_observers_; } -void SandboxMountPointProvider::AddFileUpdateObserver( +void SandboxFileSystemBackend::AddFileUpdateObserver( FileSystemType type, FileUpdateObserver* observer, base::SequencedTaskRunner* task_runner) { @@ -543,7 +543,7 @@ void SandboxMountPointProvider::AddFileUpdateObserver( *list = UpdateObserverList(observer_source); } -void SandboxMountPointProvider::AddFileChangeObserver( +void SandboxFileSystemBackend::AddFileChangeObserver( FileSystemType type, FileChangeObserver* observer, base::SequencedTaskRunner* task_runner) { @@ -555,7 +555,7 @@ void SandboxMountPointProvider::AddFileChangeObserver( *list = ChangeObserverList(observer_source); } -bool SandboxMountPointProvider::IsAccessValid( +bool SandboxFileSystemBackend::IsAccessValid( const FileSystemURL& url) const { if (!IsAllowedScheme(url.origin())) return false; @@ -590,7 +590,7 @@ bool SandboxMountPointProvider::IsAccessValid( return true; } -base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( +base::FilePath SandboxFileSystemBackend::GetUsageCachePathForOriginAndType( const GURL& origin_url, FileSystemType type) { base::PlatformFileError error; @@ -602,7 +602,7 @@ base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( } // static -base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( +base::FilePath SandboxFileSystemBackend::GetUsageCachePathForOriginAndType( ObfuscatedFileUtil* sandbox_file_util, const GURL& origin_url, fileapi::FileSystemType type, @@ -616,7 +616,7 @@ base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( return base_path.Append(FileSystemUsageCache::kUsageFileName); } -bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { +bool SandboxFileSystemBackend::IsAllowedScheme(const GURL& url) const { // Basically we only accept http or https. We allow file:// URLs // only if --allow-file-access-from-files flag is given. if (url.SchemeIs("http") || url.SchemeIs("https")) @@ -634,13 +634,13 @@ bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { return false; } -ObfuscatedFileUtil* SandboxMountPointProvider::sandbox_sync_file_util() { +ObfuscatedFileUtil* SandboxFileSystemBackend::sandbox_sync_file_util() { DCHECK(sandbox_file_util_.get()); return static_cast<ObfuscatedFileUtil*>(sandbox_file_util_->sync_file_util()); } // static -void SandboxMountPointProvider::InvalidateUsageCacheOnFileThread( +void SandboxFileSystemBackend::InvalidateUsageCacheOnFileThread( ObfuscatedFileUtil* file_util, const GURL& origin, FileSystemType type, @@ -652,7 +652,7 @@ void SandboxMountPointProvider::InvalidateUsageCacheOnFileThread( usage_cache->IncrementDirty(usage_cache_path); } -int64 SandboxMountPointProvider::RecalculateUsage(FileSystemContext* context, +int64 SandboxFileSystemBackend::RecalculateUsage(FileSystemContext* context, const GURL& origin, FileSystemType type) { FileSystemOperationContext operation_context(context); diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider.h b/webkit/browser/fileapi/sandbox_file_system_backend.h index 99e91f0..2f5b4b2 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider.h +++ b/webkit/browser/fileapi/sandbox_file_system_backend.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ -#define WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ +#ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ +#define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ #include <set> #include <string> @@ -15,7 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "url/gurl.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_options.h" #include "webkit/browser/fileapi/file_system_quota_util.h" #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" @@ -49,8 +49,8 @@ class SandboxQuotaObserver; // profile directory in a sandboxed way. // This interface also lets one enumerate and remove storage for the origins // that use the filesystem. -class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider - : public FileSystemMountPointProvider, +class WEBKIT_STORAGE_BROWSER_EXPORT SandboxFileSystemBackend + : public FileSystemBackend, public FileSystemQuotaUtil { public: // Origin enumerator interface. @@ -71,15 +71,15 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider // |file_task_runner| is used to validate the root directory and delete the // obfuscated file util. - SandboxMountPointProvider( + SandboxFileSystemBackend( quota::QuotaManagerProxy* quota_manager_proxy, base::SequencedTaskRunner* file_task_runner, const base::FilePath& profile_path, const FileSystemOptions& file_system_options, quota::SpecialStoragePolicy* special_storage_policy); - virtual ~SandboxMountPointProvider(); + virtual ~SandboxFileSystemBackend(); - // FileSystemMountPointProvider overrides. + // FileSystemBackend overrides. virtual bool CanHandleType(FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -106,7 +106,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider FileSystemContext* context) const OVERRIDE; virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; - // Returns an origin enumerator of this provider. + // Returns an origin enumerator of this backend. // This method can only be called on the file thread. OriginEnumerator* CreateOriginEnumerator(); @@ -168,8 +168,8 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider private: friend class SandboxQuotaObserver; friend class SandboxFileSystemTestHelper; - friend class SandboxMountPointProviderMigrationTest; - friend class SandboxMountPointProviderOriginEnumeratorTest; + friend class SandboxFileSystemBackendMigrationTest; + friend class SandboxFileSystemBackendOriginEnumeratorTest; // Returns a path to the usage cache file. base::FilePath GetUsageCachePathForOriginAndType( @@ -239,11 +239,11 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; - base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_; + base::WeakPtrFactory<SandboxFileSystemBackend> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); + DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend); }; } // namespace fileapi -#endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ +#endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider_unittest.cc b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc index 33fad5a..386586b 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider_unittest.cc +++ b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include <set> @@ -14,7 +14,7 @@ #include "base/message_loop/message_loop_proxy.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/mock_file_system_options.h" #include "webkit/common/fileapi/file_system_util.h" @@ -78,28 +78,28 @@ void DidOpenFileSystem(base::PlatformFileError* error_out, } // namespace -class SandboxMountPointProviderTest : public testing::Test { +class SandboxFileSystemBackendTest : public testing::Test { protected: virtual void SetUp() { ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); } - void SetUpNewProvider(const FileSystemOptions& options) { - provider_.reset( - new SandboxMountPointProvider(NULL, + void SetUpNewBackend(const FileSystemOptions& options) { + backend_.reset( + new SandboxFileSystemBackend(NULL, base::MessageLoopProxy::current().get(), data_dir_.path(), options, NULL)); } - SandboxMountPointProvider::OriginEnumerator* CreateOriginEnumerator() const { - return provider_->CreateOriginEnumerator(); + SandboxFileSystemBackend::OriginEnumerator* CreateOriginEnumerator() const { + return backend_->CreateOriginEnumerator(); } void CreateOriginTypeDirectory(const GURL& origin, fileapi::FileSystemType type) { - base::FilePath target = provider_-> + base::FilePath target = backend_-> GetBaseDirectoryForOriginAndType(origin, type, true); ASSERT_TRUE(!target.empty()); ASSERT_TRUE(file_util::DirectoryExists(target)); @@ -110,14 +110,14 @@ class SandboxMountPointProviderTest : public testing::Test { OpenFileSystemMode mode, base::FilePath* root_path) { base::PlatformFileError error = base::PLATFORM_FILE_OK; - provider_->OpenFileSystem( + backend_->OpenFileSystem( origin_url, type, mode, base::Bind(&DidOpenFileSystem, &error)); base::MessageLoop::current()->RunUntilIdle(); if (error != base::PLATFORM_FILE_OK) return false; base::FilePath returned_root_path = - provider_->GetBaseDirectoryForOriginAndType( + backend_->GetBaseDirectoryForOriginAndType( origin_url, type, false /* create */); if (root_path) *root_path = returned_root_path; @@ -126,23 +126,23 @@ class SandboxMountPointProviderTest : public testing::Test { base::FilePath file_system_path() const { return data_dir_.path().Append( - SandboxMountPointProvider::kFileSystemDirectory); + SandboxFileSystemBackend::kFileSystemDirectory); } base::ScopedTempDir data_dir_; base::MessageLoop message_loop_; - scoped_ptr<SandboxMountPointProvider> provider_; + scoped_ptr<SandboxFileSystemBackend> backend_; }; -TEST_F(SandboxMountPointProviderTest, Empty) { - SetUpNewProvider(CreateAllowFileAccessOptions()); - scoped_ptr<SandboxMountPointProvider::OriginEnumerator> enumerator( +TEST_F(SandboxFileSystemBackendTest, Empty) { + SetUpNewBackend(CreateAllowFileAccessOptions()); + scoped_ptr<SandboxFileSystemBackend::OriginEnumerator> enumerator( CreateOriginEnumerator()); ASSERT_TRUE(enumerator->Next().is_empty()); } -TEST_F(SandboxMountPointProviderTest, EnumerateOrigins) { - SetUpNewProvider(CreateAllowFileAccessOptions()); +TEST_F(SandboxFileSystemBackendTest, EnumerateOrigins) { + SetUpNewBackend(CreateAllowFileAccessOptions()); const char* temporary_origins[] = { "http://www.bar.com/", "http://www.foo.com/", @@ -169,7 +169,7 @@ TEST_F(SandboxMountPointProviderTest, EnumerateOrigins) { persistent_set.insert(GURL(persistent_origins[i])); } - scoped_ptr<SandboxMountPointProvider::OriginEnumerator> enumerator( + scoped_ptr<SandboxFileSystemBackend::OriginEnumerator> enumerator( CreateOriginEnumerator()); size_t temporary_actual_size = 0; size_t persistent_actual_size = 0; @@ -190,53 +190,53 @@ TEST_F(SandboxMountPointProviderTest, EnumerateOrigins) { EXPECT_EQ(persistent_size, persistent_actual_size); } -TEST_F(SandboxMountPointProviderTest, IsAccessValid) { - SetUpNewProvider(CreateAllowFileAccessOptions()); +TEST_F(SandboxFileSystemBackendTest, IsAccessValid) { + SetUpNewBackend(CreateAllowFileAccessOptions()); // Normal case. - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL("a"))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("a"))); // Access to a path with parent references ('..') should be disallowed. - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL("a/../b"))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("a/../b"))); // Access from non-allowed scheme should be disallowed. - EXPECT_FALSE(provider_->IsAccessValid( + EXPECT_FALSE(backend_->IsAccessValid( FileSystemURL::CreateForTest( GURL("unknown://bar"), kFileSystemTypeTemporary, base::FilePath::FromUTF8Unsafe("foo")))); // Access for non-sandbox type should be disallowed. - EXPECT_FALSE(provider_->IsAccessValid( + EXPECT_FALSE(backend_->IsAccessValid( FileSystemURL::CreateForTest( GURL("http://foo/"), kFileSystemTypeTest, base::FilePath::FromUTF8Unsafe("foo")))); // Access with restricted name should be disallowed. - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL("."))); - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL(".."))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("."))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(".."))); // This is also diallowed due to Windows XP parent path handling. - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL("..."))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL("..."))); // These are identified as unsafe cases due to weird path handling // on Windows. - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL(" .."))); - EXPECT_FALSE(provider_->IsAccessValid(CreateFileSystemURL(".. "))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(" .."))); + EXPECT_FALSE(backend_->IsAccessValid(CreateFileSystemURL(".. "))); // Similar but safe cases. - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL(" ."))); - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL(". "))); - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL("b."))); - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL(".b"))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(" ."))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(". "))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("b."))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL(".b"))); // A path that looks like a drive letter. - EXPECT_TRUE(provider_->IsAccessValid(CreateFileSystemURL("c:"))); + EXPECT_TRUE(backend_->IsAccessValid(CreateFileSystemURL("c:"))); } -TEST_F(SandboxMountPointProviderTest, GetRootPathCreateAndExamine) { +TEST_F(SandboxFileSystemBackendTest, GetRootPathCreateAndExamine) { std::vector<base::FilePath> returned_root_path( ARRAYSIZE_UNSAFE(kRootPathTestCases)); - SetUpNewProvider(CreateAllowFileAccessOptions()); + SetUpNewBackend(CreateAllowFileAccessOptions()); // Create a new root directory. for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathTestCases); ++i) { @@ -273,11 +273,11 @@ TEST_F(SandboxMountPointProviderTest, GetRootPathCreateAndExamine) { } } -TEST_F(SandboxMountPointProviderTest, - GetRootPathCreateAndExamineWithNewProvider) { +TEST_F(SandboxFileSystemBackendTest, + GetRootPathCreateAndExamineWithNewBackend) { std::vector<base::FilePath> returned_root_path( ARRAYSIZE_UNSAFE(kRootPathTestCases)); - SetUpNewProvider(CreateAllowFileAccessOptions()); + SetUpNewBackend(CreateAllowFileAccessOptions()); GURL origin_url("http://foo.com:1/"); @@ -286,7 +286,7 @@ TEST_F(SandboxMountPointProviderTest, OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, &root_path1)); - SetUpNewProvider(CreateDisallowFileAccessOptions()); + SetUpNewBackend(CreateDisallowFileAccessOptions()); base::FilePath root_path2; EXPECT_TRUE(GetRootPath(origin_url, kFileSystemTypeTemporary, OPEN_FILE_SYSTEM_FAIL_IF_NONEXISTENT, @@ -295,8 +295,8 @@ TEST_F(SandboxMountPointProviderTest, EXPECT_EQ(root_path1.value(), root_path2.value()); } -TEST_F(SandboxMountPointProviderTest, GetRootPathGetWithoutCreate) { - SetUpNewProvider(CreateDisallowFileAccessOptions()); +TEST_F(SandboxFileSystemBackendTest, GetRootPathGetWithoutCreate) { + SetUpNewBackend(CreateDisallowFileAccessOptions()); // Try to get a root directory without creating. for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathTestCases); ++i) { @@ -309,8 +309,8 @@ TEST_F(SandboxMountPointProviderTest, GetRootPathGetWithoutCreate) { } } -TEST_F(SandboxMountPointProviderTest, GetRootPathInIncognito) { - SetUpNewProvider(CreateIncognitoFileSystemOptions()); +TEST_F(SandboxFileSystemBackendTest, GetRootPathInIncognito) { + SetUpNewBackend(CreateIncognitoFileSystemOptions()); // Try to get a root directory. for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathTestCases); ++i) { @@ -324,8 +324,8 @@ TEST_F(SandboxMountPointProviderTest, GetRootPathInIncognito) { } } -TEST_F(SandboxMountPointProviderTest, GetRootPathFileURI) { - SetUpNewProvider(CreateDisallowFileAccessOptions()); +TEST_F(SandboxFileSystemBackendTest, GetRootPathFileURI) { + SetUpNewBackend(CreateDisallowFileAccessOptions()); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathFileURITestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPathFileURI (disallow) #" << i << " " << kRootPathFileURITestCases[i].expected_path); @@ -337,8 +337,8 @@ TEST_F(SandboxMountPointProviderTest, GetRootPathFileURI) { } } -TEST_F(SandboxMountPointProviderTest, GetRootPathFileURIWithAllowFlag) { - SetUpNewProvider(CreateAllowFileAccessOptions()); +TEST_F(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlag) { + SetUpNewBackend(CreateAllowFileAccessOptions()); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathFileURITestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPathFileURI (allow) #" << i << " " << kRootPathFileURITestCases[i].expected_path); diff --git a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc index 7cefa1a..84aa9de 100644 --- a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc +++ b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc @@ -16,7 +16,7 @@ #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/file_system_usage_cache.h" #include "webkit/browser/fileapi/mock_file_system_context.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/quota/mock_special_storage_policy.h" #include "webkit/common/fileapi/file_system_util.h" @@ -62,7 +62,7 @@ void SandboxFileSystemTestHelper::TearDown() { } base::FilePath SandboxFileSystemTestHelper::GetOriginRootPath() { - return file_system_context_->sandbox_provider()-> + return file_system_context_->sandbox_backend()-> GetBaseDirectoryForOriginAndType(origin_, type_, false); } @@ -82,7 +82,7 @@ base::FilePath SandboxFileSystemTestHelper::GetLocalPathFromASCII( base::FilePath SandboxFileSystemTestHelper::GetUsageCachePath() const { return file_system_context_-> - sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); + sandbox_backend()->GetUsageCachePathForOriginAndType(origin_, type_); } FileSystemURL SandboxFileSystemTestHelper::CreateURL( @@ -125,23 +125,23 @@ SandboxFileSystemTestHelper::NewOperationContext() { void SandboxFileSystemTestHelper::AddFileChangeObserver( FileChangeObserver* observer) { - file_system_context_->sandbox_provider()-> + file_system_context_->sandbox_backend()-> AddFileChangeObserver(type_, observer, NULL); } FileSystemUsageCache* SandboxFileSystemTestHelper::usage_cache() { - return file_system_context()->sandbox_provider()->usage_cache(); + return file_system_context()->sandbox_backend()->usage_cache(); } void SandboxFileSystemTestHelper::SetUpFileSystem() { DCHECK(file_system_context_.get()); - DCHECK(file_system_context_->sandbox_provider()->CanHandleType(type_)); + DCHECK(file_system_context_->sandbox_backend()->CanHandleType(type_)); file_util_ = file_system_context_->GetFileUtil(type_); DCHECK(file_util_); // Prepare the origin's root directory. - file_system_context_->sandbox_provider()-> + file_system_context_->sandbox_backend()-> GetBaseDirectoryForOriginAndType(origin_, type_, true /* create */); // Initialize the usage cache file. diff --git a/webkit/browser/fileapi/sandbox_quota_observer.cc b/webkit/browser/fileapi/sandbox_quota_observer.cc index a061e3e..b28f335 100644 --- a/webkit/browser/fileapi/sandbox_quota_observer.cc +++ b/webkit/browser/fileapi/sandbox_quota_observer.cc @@ -7,7 +7,7 @@ #include "base/sequenced_task_runner.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/file_system_usage_cache.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/timed_task_helper.h" #include "webkit/browser/quota/quota_client.h" #include "webkit/browser/quota/quota_manager.h" @@ -107,7 +107,7 @@ base::FilePath SandboxQuotaObserver::GetUsageCachePath( DCHECK(sandbox_file_util_); base::PlatformFileError error = base::PLATFORM_FILE_OK; base::FilePath path = - SandboxMountPointProvider::GetUsageCachePathForOriginAndType( + SandboxFileSystemBackend::GetUsageCachePathForOriginAndType( sandbox_file_util_, url.origin(), url.type(), &error); if (error != base::PLATFORM_FILE_OK) { LOG(WARNING) << "Could not get usage cache path for: " diff --git a/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc b/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc index 8bad8f3..37c5efc 100644 --- a/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc +++ b/webkit/browser/fileapi/syncable/canned_syncable_file_system.cc @@ -16,13 +16,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "webkit/browser/blob/mock_blob_url_request_context.h" #include "webkit/browser/fileapi/external_mount_points.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_task_runners.h" #include "webkit/browser/fileapi/mock_file_system_options.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h" #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" @@ -239,7 +239,7 @@ void CannedSyncableFileSystem::SetUp() { fileapi::ExternalMountPoints::CreateRefCounted().get(), storage_policy.get(), quota_manager_->proxy(), - ScopedVector<fileapi::FileSystemMountPointProvider>(), + ScopedVector<fileapi::FileSystemBackend>(), data_dir_.path(), options); is_filesystem_set_up_ = true; diff --git a/webkit/browser/fileapi/syncable/syncable_file_system_operation.cc b/webkit/browser/fileapi/syncable/syncable_file_system_operation.cc index b256813..6773809 100644 --- a/webkit/browser/fileapi/syncable/syncable_file_system_operation.cc +++ b/webkit/browser/fileapi/syncable/syncable_file_system_operation.cc @@ -10,7 +10,7 @@ #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/local_file_system_operation.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/browser/fileapi/syncable/local_file_sync_context.h" #include "webkit/browser/fileapi/syncable/syncable_file_operation_runner.h" #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h" diff --git a/webkit/browser/fileapi/syncable/syncable_file_system_operation.h b/webkit/browser/fileapi/syncable/syncable_file_system_operation.h index 821dbfa..e8e5c65 100644 --- a/webkit/browser/fileapi/syncable/syncable_file_system_operation.h +++ b/webkit/browser/fileapi/syncable/syncable_file_system_operation.h @@ -18,7 +18,7 @@ namespace fileapi { class FileSystemContext; class FileSystemOperationContext; -class SandboxMountPointProvider; +class SandboxFileSystemBackend; } namespace sync_file_system { @@ -87,9 +87,9 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SyncableFileSystemOperation typedef SyncableFileSystemOperation self; class QueueableTask; - // Only MountPointProviders can create a new operation directly. - friend class fileapi::SandboxMountPointProvider; - friend class SandboxMountPointProvider; + // Only FileSystemBackends can create a new operation directly. + friend class fileapi::SandboxFileSystemBackend; + friend class SandboxFileSystemBackend; SyncableFileSystemOperation( const fileapi::FileSystemURL& url, fileapi::FileSystemContext* file_system_context, diff --git a/webkit/browser/fileapi/syncable/syncable_file_system_util.cc b/webkit/browser/fileapi/syncable/syncable_file_system_util.cc index a703dbd..5aadca5 100644 --- a/webkit/browser/fileapi/syncable/syncable_file_system_util.cc +++ b/webkit/browser/fileapi/syncable/syncable_file_system_util.cc @@ -8,7 +8,7 @@ #include "webkit/browser/fileapi/external_mount_points.h" #include "webkit/browser/fileapi/file_observers.h" #include "webkit/browser/fileapi/file_system_context.h" -#include "webkit/browser/fileapi/sandbox_mount_point_provider.h" +#include "webkit/browser/fileapi/sandbox_file_system_backend.h" #include "webkit/common/fileapi/file_system_util.h" using fileapi::ExternalMountPoints; diff --git a/webkit/browser/fileapi/test_mount_point_provider.cc b/webkit/browser/fileapi/test_file_system_backend.cc index 20a1a4a..ff7ebff 100644 --- a/webkit/browser/fileapi/test_mount_point_provider.cc +++ b/webkit/browser/fileapi/test_file_system_backend.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "webkit/browser/fileapi/test_mount_point_provider.h" +#include "webkit/browser/fileapi/test_file_system_backend.h" #include <set> #include <string> @@ -25,7 +25,7 @@ namespace fileapi { // This only supports single origin. -class TestMountPointProvider::QuotaUtil +class TestFileSystemBackend::QuotaUtil : public FileSystemQuotaUtil, public FileUpdateObserver { public: @@ -79,7 +79,7 @@ class TestMountPointProvider::QuotaUtil int64 usage_; }; -TestMountPointProvider::TestMountPointProvider( +TestFileSystemBackend::TestFileSystemBackend( base::SequencedTaskRunner* task_runner, const base::FilePath& base_path) : base_path_(base_path), @@ -92,14 +92,14 @@ TestMountPointProvider::TestMountPointProvider( update_observers_ = UpdateObserverList(source); } -TestMountPointProvider::~TestMountPointProvider() { +TestFileSystemBackend::~TestFileSystemBackend() { } -bool TestMountPointProvider::CanHandleType(FileSystemType type) const { +bool TestFileSystemBackend::CanHandleType(FileSystemType type) const { return (type == kFileSystemTypeTest); } -void TestMountPointProvider::OpenFileSystem( +void TestFileSystemBackend::OpenFileSystem( const GURL& origin_url, FileSystemType type, OpenFileSystemMode mode, @@ -107,17 +107,17 @@ void TestMountPointProvider::OpenFileSystem( callback.Run(base::PLATFORM_FILE_OK); } -FileSystemFileUtil* TestMountPointProvider::GetFileUtil(FileSystemType type) { +FileSystemFileUtil* TestFileSystemBackend::GetFileUtil(FileSystemType type) { DCHECK(local_file_util_.get()); return local_file_util_->sync_file_util(); } -AsyncFileUtil* TestMountPointProvider::GetAsyncFileUtil(FileSystemType type) { +AsyncFileUtil* TestFileSystemBackend::GetAsyncFileUtil(FileSystemType type) { return local_file_util_.get(); } CopyOrMoveFileValidatorFactory* -TestMountPointProvider::GetCopyOrMoveFileValidatorFactory( +TestFileSystemBackend::GetCopyOrMoveFileValidatorFactory( FileSystemType type, base::PlatformFileError* error_code) { DCHECK(error_code); *error_code = base::PLATFORM_FILE_OK; @@ -129,7 +129,7 @@ TestMountPointProvider::GetCopyOrMoveFileValidatorFactory( return NULL; } -void TestMountPointProvider::InitializeCopyOrMoveFileValidatorFactory( +void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory( scoped_ptr<CopyOrMoveFileValidatorFactory> factory) { if (!require_copy_or_move_validator_) { DCHECK(!factory); @@ -139,7 +139,7 @@ void TestMountPointProvider::InitializeCopyOrMoveFileValidatorFactory( copy_or_move_file_validator_factory_ = factory.Pass(); } -FileSystemOperation* TestMountPointProvider::CreateFileSystemOperation( +FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( const FileSystemURL& url, FileSystemContext* context, base::PlatformFileError* error_code) const { @@ -152,7 +152,7 @@ FileSystemOperation* TestMountPointProvider::CreateFileSystemOperation( } scoped_ptr<webkit_blob::FileStreamReader> -TestMountPointProvider::CreateFileStreamReader( +TestFileSystemBackend::CreateFileStreamReader( const FileSystemURL& url, int64 offset, const base::Time& expected_modification_time, @@ -163,7 +163,7 @@ TestMountPointProvider::CreateFileStreamReader( } scoped_ptr<fileapi::FileStreamWriter> -TestMountPointProvider::CreateFileStreamWriter( +TestFileSystemBackend::CreateFileStreamWriter( const FileSystemURL& url, int64 offset, FileSystemContext* context) const { @@ -171,16 +171,16 @@ TestMountPointProvider::CreateFileStreamWriter( new SandboxFileStreamWriter(context, url, offset, update_observers_)); } -FileSystemQuotaUtil* TestMountPointProvider::GetQuotaUtil() { +FileSystemQuotaUtil* TestFileSystemBackend::GetQuotaUtil() { return quota_util_.get(); } -const UpdateObserverList* TestMountPointProvider::GetUpdateObservers( +const UpdateObserverList* TestFileSystemBackend::GetUpdateObservers( FileSystemType type) const { return &update_observers_; } -void TestMountPointProvider::AddFileChangeObserver( +void TestFileSystemBackend::AddFileChangeObserver( FileChangeObserver* observer) { ChangeObserverList::Source source = change_observers_.source(); source.AddObserver(observer, task_runner_.get()); diff --git a/webkit/browser/fileapi/test_mount_point_provider.h b/webkit/browser/fileapi/test_file_system_backend.h index 0bb139b..68a23b6 100644 --- a/webkit/browser/fileapi/test_mount_point_provider.h +++ b/webkit/browser/fileapi/test_file_system_backend.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ -#define WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ +#ifndef WEBKIT_BROWSER_FILEAPI_TEST_FILE_SYSTEM_BACKEND_H_ +#define WEBKIT_BROWSER_FILEAPI_TEST_FILE_SYSTEM_BACKEND_H_ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "webkit/browser/fileapi/async_file_util_adapter.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" #include "webkit/browser/webkit_storage_browser_export.h" @@ -23,17 +23,17 @@ class AsyncFileUtilAdapter; class FileSystemQuotaUtil; // This should be only used for testing. -// This mount point provider uses LocalFileUtil and stores data file +// This file system backend uses LocalFileUtil and stores data file // under the given directory. -class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestMountPointProvider - : public FileSystemMountPointProvider { +class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestFileSystemBackend + : public FileSystemBackend { public: - TestMountPointProvider( + TestFileSystemBackend( base::SequencedTaskRunner* task_runner, const base::FilePath& base_path); - virtual ~TestMountPointProvider(); + virtual ~TestFileSystemBackend(); - // FileSystemMountPointProvider implementation. + // FileSystemBackend implementation. virtual bool CanHandleType(FileSystemType type) const OVERRIDE; virtual void OpenFileSystem( const GURL& origin_url, @@ -89,9 +89,9 @@ class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE TestMountPointProvider scoped_ptr<CopyOrMoveFileValidatorFactory> copy_or_move_file_validator_factory_; - DISALLOW_COPY_AND_ASSIGN(TestMountPointProvider); + DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend); }; } // namespace fileapi -#endif // WEBKIT_BROWSER_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ +#endif // WEBKIT_BROWSER_FILEAPI_TEST_FILE_SYSTEM_BACKEND_H_ diff --git a/webkit/browser/fileapi/upload_file_system_file_element_reader_unittest.cc b/webkit/browser/fileapi/upload_file_system_file_element_reader_unittest.cc index ad6fdc6..537973d 100644 --- a/webkit/browser/fileapi/upload_file_system_file_element_reader_unittest.cc +++ b/webkit/browser/fileapi/upload_file_system_file_element_reader_unittest.cc @@ -9,9 +9,9 @@ #include "net/base/io_buffer.h" #include "net/base/test_completion_callback.h" #include "testing/gtest/include/gtest/gtest.h" +#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_file_util.h" -#include "webkit/browser/fileapi/file_system_mount_point_provider.h" #include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/browser/fileapi/mock_file_system_context.h" diff --git a/webkit/storage_browser.gyp b/webkit/storage_browser.gyp index 01f6dcf..d70447c 100644 --- a/webkit/storage_browser.gyp +++ b/webkit/storage_browser.gyp @@ -124,6 +124,7 @@ 'browser/fileapi/file_permission_policy.cc', 'browser/fileapi/file_permission_policy.h', 'browser/fileapi/file_stream_writer.h', + 'browser/fileapi/file_system_backend.h', 'browser/fileapi/file_system_context.cc', 'browser/fileapi/file_system_context.h', 'browser/fileapi/file_system_dir_url_request_job.cc', @@ -132,7 +133,6 @@ 'browser/fileapi/file_system_file_stream_reader.h', 'browser/fileapi/file_system_file_util.cc', 'browser/fileapi/file_system_file_util.h', - 'browser/fileapi/file_system_mount_point_provider.h', 'browser/fileapi/file_system_operation.h', 'browser/fileapi/file_system_operation_context.cc', 'browser/fileapi/file_system_operation_context.h', @@ -157,10 +157,10 @@ 'browser/fileapi/file_writer_delegate.h', 'browser/fileapi/isolated_context.cc', 'browser/fileapi/isolated_context.h', + 'browser/fileapi/isolated_file_system_backend.cc', + 'browser/fileapi/isolated_file_system_backend.h', 'browser/fileapi/isolated_file_util.cc', 'browser/fileapi/isolated_file_util.h', - 'browser/fileapi/isolated_mount_point_provider.cc', - 'browser/fileapi/isolated_mount_point_provider.h', 'browser/fileapi/local_file_stream_writer.cc', 'browser/fileapi/local_file_stream_writer.h', 'browser/fileapi/local_file_system_operation.cc', @@ -183,10 +183,10 @@ 'browser/fileapi/sandbox_directory_database.h', 'browser/fileapi/sandbox_file_stream_writer.cc', 'browser/fileapi/sandbox_file_stream_writer.h', + 'browser/fileapi/sandbox_file_system_backend.cc', + 'browser/fileapi/sandbox_file_system_backend.h', 'browser/fileapi/sandbox_isolated_origin_database.cc', 'browser/fileapi/sandbox_isolated_origin_database.h', - 'browser/fileapi/sandbox_mount_point_provider.cc', - 'browser/fileapi/sandbox_mount_point_provider.h', 'browser/fileapi/sandbox_origin_database.cc', 'browser/fileapi/sandbox_origin_database.h', 'browser/fileapi/sandbox_origin_database_interface.cc', @@ -216,8 +216,8 @@ 'browser/fileapi/syncable/syncable_file_system_util.cc', 'browser/fileapi/syncable/syncable_file_system_util.h', 'browser/fileapi/task_runner_bound_observer_list.h', - 'browser/fileapi/test_mount_point_provider.cc', - 'browser/fileapi/test_mount_point_provider.h', + 'browser/fileapi/test_file_system_backend.cc', + 'browser/fileapi/test_file_system_backend.h', 'browser/fileapi/timed_task_helper.cc', 'browser/fileapi/timed_task_helper.h', 'browser/fileapi/transient_file_util.cc', |