diff options
author | pilgrim@chromium.org <pilgrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-22 19:58:31 +0000 |
---|---|---|
committer | pilgrim@chromium.org <pilgrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-22 20:01:57 +0000 |
commit | cd501a7565dd6054a120fbfe62d45b2299cfcc3b (patch) | |
tree | efe35c31d00f40b2fa9e6dbafd5f9f694f47367e /chrome/browser/extensions/api | |
parent | 604e202d3548b701900c3771f9517103bb91486c (diff) | |
download | chromium_src-cd501a7565dd6054a120fbfe62d45b2299cfcc3b.zip chromium_src-cd501a7565dd6054a120fbfe62d45b2299cfcc3b.tar.gz chromium_src-cd501a7565dd6054a120fbfe62d45b2299cfcc3b.tar.bz2 |
Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single storage namespace
As discussed here:
https://groups.google.com/a/chromium.org/forum/#!topic/storage-dev/aQall8GOrS4
BUG=338338
TBR=cevans
NOTRY=true
Review URL: https://codereview.chromium.org/492873002
Cr-Commit-Position: refs/heads/master@{#291485}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api')
17 files changed, 116 insertions, 110 deletions
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index ff6e003..eb245c4 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc @@ -1070,10 +1070,10 @@ bool DeveloperPrivateLoadDirectoryFunction::RunAsync() { // Directory url is non empty only for syncfilesystem. if (directory_url_str != "") { - fileapi::FileSystemURL directory_url = + storage::FileSystemURL directory_url = context_->CrackURL(GURL(directory_url_str)); if (!directory_url.is_valid() || - directory_url.type() != fileapi::kFileSystemTypeSyncable) { + directory_url.type() != storage::kFileSystemTypeSyncable) { SetError("DirectoryEntry of unsupported filesystem."); return false; } @@ -1093,21 +1093,21 @@ bool DeveloperPrivateLoadDirectoryFunction::RunAsync() { // points to a non-native local directory. std::string filesystem_id; bool cracked = - fileapi::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id); + storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id); CHECK(cracked); base::FilePath virtual_path = - fileapi::IsolatedContext::GetInstance() + storage::IsolatedContext::GetInstance() ->CreateVirtualRootPath(filesystem_id) .Append(base::FilePath::FromUTF8Unsafe(filesystem_path)); - fileapi::FileSystemURL directory_url = context_->CreateCrackedFileSystemURL( + storage::FileSystemURL directory_url = context_->CreateCrackedFileSystemURL( extensions::Extension::GetBaseURLFromExtensionId(extension_id()), - fileapi::kFileSystemTypeIsolated, + storage::kFileSystemTypeIsolated, virtual_path); if (directory_url.is_valid() && - directory_url.type() != fileapi::kFileSystemTypeNativeLocal && - directory_url.type() != fileapi::kFileSystemTypeRestrictedNativeLocal && - directory_url.type() != fileapi::kFileSystemTypeDragged) { + directory_url.type() != storage::kFileSystemTypeNativeLocal && + directory_url.type() != storage::kFileSystemTypeRestrictedNativeLocal && + directory_url.type() != storage::kFileSystemTypeDragged) { return LoadByFileSystemAPI(directory_url); } @@ -1118,7 +1118,7 @@ bool DeveloperPrivateLoadDirectoryFunction::RunAsync() { } bool DeveloperPrivateLoadDirectoryFunction::LoadByFileSystemAPI( - const fileapi::FileSystemURL& directory_url) { + const storage::FileSystemURL& directory_url) { std::string directory_url_str = directory_url.ToGURL().spec(); size_t pos = 0; @@ -1176,7 +1176,7 @@ void DeveloperPrivateLoadDirectoryFunction::ReadDirectoryByFileSystemAPI( const base::FilePath& project_path, const base::FilePath& destination_path) { GURL project_url = GURL(project_base_url_ + destination_path.AsUTF8Unsafe()); - fileapi::FileSystemURL url = context_->CrackURL(project_url); + storage::FileSystemURL url = context_->CrackURL(project_url); context_->operation_runner()->ReadDirectory( url, base::Bind(&DeveloperPrivateLoadDirectoryFunction:: @@ -1188,9 +1188,8 @@ void DeveloperPrivateLoadDirectoryFunction::ReadDirectoryByFileSystemAPICb( const base::FilePath& project_path, const base::FilePath& destination_path, base::File::Error status, - const fileapi::FileSystemOperation::FileEntryList& file_list, + const storage::FileSystemOperation::FileEntryList& file_list, bool has_more) { - if (status != base::File::FILE_OK) { DLOG(ERROR) << "Error in copying files from sync filesystem."; return; @@ -1214,7 +1213,7 @@ void DeveloperPrivateLoadDirectoryFunction::ReadDirectoryByFileSystemAPICb( GURL project_url = GURL(project_base_url_ + destination_path.Append(file_list[i].name).AsUTF8Unsafe()); - fileapi::FileSystemURL url = context_->CrackURL(project_url); + storage::FileSystemURL url = context_->CrackURL(project_url); base::FilePath target_path = project_path; target_path = target_path.Append(file_list[i].name); @@ -1245,7 +1244,7 @@ void DeveloperPrivateLoadDirectoryFunction::SnapshotFileCallback( base::File::Error result, const base::File::Info& file_info, const base::FilePath& src_path, - const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { + const scoped_refptr<storage::ShareableFileReference>& file_ref) { if (result != base::File::FILE_OK) { SetError("Error in copying files from sync filesystem."); success_ = false; diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.h b/chrome/browser/extensions/api/developer_private/developer_private_api.h index 6525bd4..5ac8ae9 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.h +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.h @@ -412,7 +412,7 @@ class DeveloperPrivateLoadDirectoryFunction // ExtensionFunction: virtual bool RunAsync() OVERRIDE; - bool LoadByFileSystemAPI(const fileapi::FileSystemURL& directory_url); + bool LoadByFileSystemAPI(const storage::FileSystemURL& directory_url); void ClearExistingDirectoryContent(const base::FilePath& project_path); @@ -423,7 +423,7 @@ class DeveloperPrivateLoadDirectoryFunction const base::FilePath& project_path, const base::FilePath& destination_path, base::File::Error result, - const fileapi::FileSystemOperation::FileEntryList& file_list, + const storage::FileSystemOperation::FileEntryList& file_list, bool has_more); void SnapshotFileCallback( @@ -431,14 +431,14 @@ class DeveloperPrivateLoadDirectoryFunction base::File::Error result, const base::File::Info& file_info, const base::FilePath& platform_path, - const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); + const scoped_refptr<storage::ShareableFileReference>& file_ref); void CopyFile(const base::FilePath& src_path, const base::FilePath& dest_path); void Load(); - scoped_refptr<fileapi::FileSystemContext> context_; + scoped_refptr<storage::FileSystemContext> context_; // syncfs url representing the root of the folder to be copied. std::string project_base_url_; diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index 8853e1e1..5aecf46 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -699,9 +699,9 @@ class ScopedItemVectorCanceller { // Writes an HTML5 file so that it can be downloaded. class HTML5FileWriter { public: - static bool CreateFileForTesting(fileapi::FileSystemContext* context, - const fileapi::FileSystemURL& path, - const char*data, + static bool CreateFileForTesting(storage::FileSystemContext* context, + const storage::FileSystemURL& path, + const char* data, int length) { // Create a temp file. base::FilePath temp_file; @@ -735,8 +735,8 @@ class HTML5FileWriter { } static void CreateFileForTestingOnIOThread( - fileapi::FileSystemContext* context, - const fileapi::FileSystemURL& path, + storage::FileSystemContext* context, + const storage::FileSystemURL& path, const base::FilePath& temp_file, bool* result, base::WaitableEvent* done_event) { @@ -2331,10 +2331,11 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, // Setup a file in the filesystem which we can download. ASSERT_TRUE(HTML5FileWriter::CreateFileForTesting( - BrowserContext::GetDefaultStoragePartition(browser()->profile())-> - GetFileSystemContext(), - fileapi::FileSystemURL::CreateForTest(GURL(download_url)), - kPayloadData, strlen(kPayloadData))); + BrowserContext::GetDefaultStoragePartition(browser()->profile()) + ->GetFileSystemContext(), + storage::FileSystemURL::CreateForTest(GURL(download_url)), + kPayloadData, + strlen(kPayloadData))); // Now download it. scoped_ptr<base::Value> result(RunFunctionAndReturnResult( diff --git a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc index dd6b81d..8dfa1f1 100644 --- a/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc +++ b/chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc @@ -292,12 +292,14 @@ GrantedFileEntry CreateFileEntry( const base::FilePath& path, bool is_directory) { GrantedFileEntry result; - fileapi::IsolatedContext* isolated_context = - fileapi::IsolatedContext::GetInstance(); + storage::IsolatedContext* isolated_context = + storage::IsolatedContext::GetInstance(); DCHECK(isolated_context); result.filesystem_id = isolated_context->RegisterFileSystemForPath( - fileapi::kFileSystemTypeNativeForPlatformApp, std::string(), path, + storage::kFileSystemTypeNativeForPlatformApp, + std::string(), + path, &result.registered_name); content::ChildProcessSecurityPolicy* policy = @@ -344,7 +346,7 @@ bool ValidateFileEntryAndGetPath( } std::string filesystem_id; - if (!fileapi::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) { + if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) { *error = kInvalidParameters; return false; } @@ -359,13 +361,13 @@ bool ValidateFileEntryAndGetPath( return false; } - fileapi::IsolatedContext* context = fileapi::IsolatedContext::GetInstance(); + storage::IsolatedContext* context = storage::IsolatedContext::GetInstance(); base::FilePath relative_path = base::FilePath::FromUTF8Unsafe(filesystem_path); base::FilePath virtual_path = context->CreateVirtualRootPath(filesystem_id) .Append(relative_path); - fileapi::FileSystemType type; - fileapi::FileSystemMountOption mount_option; + storage::FileSystemType type; + storage::FileSystemMountOption mount_option; std::string cracked_id; if (!context->CrackVirtualPath( virtual_path, &filesystem_id, &type, &cracked_id, file_path, @@ -377,8 +379,8 @@ bool ValidateFileEntryAndGetPath( // The file system API is only intended to operate on file entries that // correspond to a native file, selected by the user so only allow file // systems returned by the file system API or from a drag and drop operation. - if (type != fileapi::kFileSystemTypeNativeForPlatformApp && - type != fileapi::kFileSystemTypeDragged) { + if (type != storage::kFileSystemTypeNativeForPlatformApp && + type != storage::kFileSystemTypeDragged) { *error = kInvalidParameters; return false; } diff --git a/chrome/browser/extensions/api/file_handlers/mime_util.cc b/chrome/browser/extensions/api/file_handlers/mime_util.cc index 6045d57..a4594ba 100644 --- a/chrome/browser/extensions/api/file_handlers/mime_util.cc +++ b/chrome/browser/extensions/api/file_handlers/mime_util.cc @@ -153,7 +153,7 @@ MimeTypeCollector::~MimeTypeCollector() { } void MimeTypeCollector::CollectForURLs( - const std::vector<fileapi::FileSystemURL>& urls, + const std::vector<storage::FileSystemURL>& urls, const CompletionCallback& callback) { std::vector<base::FilePath> local_paths; for (size_t i = 0; i < urls.size(); ++i) { diff --git a/chrome/browser/extensions/api/file_handlers/mime_util.h b/chrome/browser/extensions/api/file_handlers/mime_util.h index 16332b8..e1bc248 100644 --- a/chrome/browser/extensions/api/file_handlers/mime_util.h +++ b/chrome/browser/extensions/api/file_handlers/mime_util.h @@ -20,9 +20,9 @@ namespace base { class FilePath; } // namespace base -namespace fileapi { +namespace storage { class FileSystemURL; -} // namespace fileapi +} // namespace storage namespace extensions { namespace app_file_handler_util { @@ -48,7 +48,7 @@ class MimeTypeCollector { // Collects all mime types asynchronously for a vector of URLs and upon // completion, calls the |callback|. It can be called only once. - void CollectForURLs(const std::vector<fileapi::FileSystemURL>& urls, + void CollectForURLs(const std::vector<storage::FileSystemURL>& urls, const CompletionCallback& callback); // Collects all mime types asynchronously for a vector of local file paths and diff --git a/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc b/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc index 626e895..bf6fd6d 100644 --- a/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc +++ b/chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc @@ -38,11 +38,11 @@ void OnMimeTypesCollected(std::vector<std::string>* output, } // Creates a native local file system URL for a local path. -fileapi::FileSystemURL CreateNativeLocalFileSystemURL( - fileapi::FileSystemContext* context, +storage::FileSystemURL CreateNativeLocalFileSystemURL( + storage::FileSystemContext* context, const base::FilePath local_path) { return context->CreateCrackedFileSystemURL( - GURL(kOrigin), fileapi::kFileSystemTypeNativeLocal, local_path); + GURL(kOrigin), storage::kFileSystemTypeNativeLocal, local_path); } } // namespace @@ -65,7 +65,7 @@ class FileHandlersMimeUtilTest : public testing::Test { content::TestBrowserThreadBundle thread_bundle_; TestingProfile profile_; - scoped_refptr<fileapi::FileSystemContext> file_system_context_; + scoped_refptr<storage::FileSystemContext> file_system_context_; base::ScopedTempDir data_dir_; base::FilePath html_mime_file_path_; }; @@ -104,7 +104,7 @@ TEST_F(FileHandlersMimeUtilTest, GetMimeTypeForLocalPath) { TEST_F(FileHandlersMimeUtilTest, MimeTypeCollector_ForURLs) { MimeTypeCollector collector(&profile_); - std::vector<fileapi::FileSystemURL> urls; + std::vector<storage::FileSystemURL> urls; urls.push_back(CreateNativeLocalFileSystemURL( file_system_context_, base::FilePath::FromUTF8Unsafe(kJPEGExtensionFilePath))); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index 1622f15..8419930 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -59,7 +59,7 @@ using apps::SavedFileEntry; using apps::SavedFilesService; using apps::AppWindow; -using fileapi::IsolatedContext; +using storage::IsolatedContext; const char kInvalidCallingPage[] = "Invalid calling page. This function can't " "be called from a background page."; @@ -349,7 +349,7 @@ bool FileSystemIsWritableEntryFunction::RunSync() { EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &filesystem_path)); std::string filesystem_id; - if (!fileapi::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) { + if (!storage::CrackIsolatedFileSystemName(filesystem_name, &filesystem_id)) { error_ = app_file_handler_util::kInvalidParameters; return false; } @@ -570,10 +570,10 @@ void FileSystemChooseEntryFunction::RegisterTempExternalFileSystemForTest( // For testing on Chrome OS, where to deal with remote and local paths // smoothly, all accessed paths need to be registered in the list of // external mount points. - fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( + storage::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( name, - fileapi::kFileSystemTypeNativeLocal, - fileapi::FileSystemMountOption(), + storage::kFileSystemTypeNativeLocal, + storage::FileSystemMountOption(), path); } diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc index b342c24..37b09b5 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc @@ -23,7 +23,7 @@ using content::BrowserThread; using content::ChildProcessSecurityPolicy; using content::WebContents; using extensions::PageCaptureSaveAsMHTMLFunction; -using webkit_blob::ShareableFileReference; +using storage::ShareableFileReference; namespace SaveAsMHTML = extensions::api::page_capture::SaveAsMHTML; @@ -43,7 +43,7 @@ PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() { PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() { if (mhtml_file_.get()) { - webkit_blob::ShareableFileReference* to_release = mhtml_file_.get(); + storage::ShareableFileReference* to_release = mhtml_file_.get(); to_release->AddRef(); mhtml_file_ = NULL; BrowserThread::ReleaseSoon(BrowserThread::IO, FROM_HERE, to_release); diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.h b/chrome/browser/extensions/api/page_capture/page_capture_api.h index c58a781..2cfe6ad 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_api.h +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.h @@ -60,7 +60,7 @@ class PageCaptureSaveAsMHTMLFunction : public ChromeAsyncExtensionFunction { base::FilePath mhtml_path_; // The file containing the MHTML. - scoped_refptr<webkit_blob::ShareableFileReference> mhtml_file_; + scoped_refptr<storage::ShareableFileReference> mhtml_file_; DECLARE_EXTENSION_FUNCTION("pageCapture.saveAsMHTML", PAGECAPTURE_SAVEASMHTML) }; diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc index 25dda794..f84f129 100644 --- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc +++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc @@ -85,7 +85,7 @@ void ExtensionSyncEventObserver::OnSyncStateUpdated( } void ExtensionSyncEventObserver::OnFileSynced( - const fileapi::FileSystemURL& url, + const storage::FileSystemURL& url, sync_file_system::SyncFileStatus status, sync_file_system::SyncAction action, sync_file_system::SyncDirection direction) { diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h index f94f891..73510e4 100644 --- a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h +++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h @@ -44,11 +44,10 @@ class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, sync_file_system::SyncServiceState state, const std::string& description) OVERRIDE; - virtual void OnFileSynced( - const fileapi::FileSystemURL& url, - sync_file_system::SyncFileStatus status, - sync_file_system::SyncAction action, - sync_file_system::SyncDirection direction) OVERRIDE; + virtual void OnFileSynced(const storage::FileSystemURL& url, + sync_file_system::SyncFileStatus status, + sync_file_system::SyncAction action, + sync_file_system::SyncDirection direction) OVERRIDE; private: friend class BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>; diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc index 5a8177e..6181124 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.cc @@ -68,17 +68,17 @@ bool SyncFileSystemDeleteFileSystemFunction::RunAsync() { std::string url; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); - scoped_refptr<fileapi::FileSystemContext> file_system_context = + scoped_refptr<storage::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(GetProfile(), render_view_host()->GetSiteInstance()) ->GetFileSystemContext(); - fileapi::FileSystemURL file_system_url( + storage::FileSystemURL file_system_url( file_system_context->CrackURL(GURL(url))); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - Bind(&fileapi::FileSystemContext::DeleteFileSystem, + Bind(&storage::FileSystemContext::DeleteFileSystem, file_system_context, source_url().GetOrigin(), file_system_url.type(), @@ -120,18 +120,18 @@ bool SyncFileSystemRequestFileSystemFunction::RunAsync() { // Initializes sync context for this extension and continue to open // a new file system. - BrowserThread::PostTask( - BrowserThread::IO, FROM_HERE, - Bind(&fileapi::FileSystemContext::OpenFileSystem, - GetFileSystemContext(), - source_url().GetOrigin(), - fileapi::kFileSystemTypeSyncable, - fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, - base::Bind(&self::DidOpenFileSystem, this))); + BrowserThread::PostTask(BrowserThread::IO, + FROM_HERE, + Bind(&storage::FileSystemContext::OpenFileSystem, + GetFileSystemContext(), + source_url().GetOrigin(), + storage::kFileSystemTypeSyncable, + storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, + base::Bind(&self::DidOpenFileSystem, this))); return true; } -fileapi::FileSystemContext* +storage::FileSystemContext* SyncFileSystemRequestFileSystemFunction::GetFileSystemContext() { DCHECK(render_view_host()); return BrowserContext::GetStoragePartition( @@ -171,11 +171,11 @@ bool SyncFileSystemGetFileStatusFunction::RunAsync() { std::string url; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); - scoped_refptr<fileapi::FileSystemContext> file_system_context = + scoped_refptr<storage::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(GetProfile(), render_view_host()->GetSiteInstance()) ->GetFileSystemContext(); - fileapi::FileSystemURL file_system_url( + storage::FileSystemURL file_system_url( file_system_context->CrackURL(GURL(url))); GetSyncFileSystemService(GetProfile())->GetFileSyncStatus( @@ -211,7 +211,7 @@ bool SyncFileSystemGetFileStatusesFunction::RunAsync() { base::ListValue* file_entry_urls = NULL; EXTENSION_FUNCTION_VALIDATE(args_->GetList(0, &file_entry_urls)); - scoped_refptr<fileapi::FileSystemContext> file_system_context = + scoped_refptr<storage::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(GetProfile(), render_view_host()->GetSiteInstance()) ->GetFileSystemContext(); @@ -226,7 +226,7 @@ bool SyncFileSystemGetFileStatusesFunction::RunAsync() { for (unsigned int i = 0; i < num_expected_results_; i++) { std::string url; file_entry_urls->GetString(i, &url); - fileapi::FileSystemURL file_system_url( + storage::FileSystemURL file_system_url( file_system_context->CrackURL(GURL(url))); sync_file_system_service->GetFileSyncStatus( @@ -239,7 +239,7 @@ bool SyncFileSystemGetFileStatusesFunction::RunAsync() { } void SyncFileSystemGetFileStatusesFunction::DidGetFileStatus( - const fileapi::FileSystemURL& file_system_url, + const storage::FileSystemURL& file_system_url, SyncStatusCode sync_status_code, SyncFileStatus sync_file_status) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -265,7 +265,7 @@ void SyncFileSystemGetFileStatusesFunction::DidGetFileStatus( base::DictionaryValue* dict = new base::DictionaryValue(); status_array->Append(dict); - fileapi::FileSystemURL url = it->first; + storage::FileSystemURL url = it->first; SyncStatusCode file_error = it->second.first; api::sync_file_system::FileStatus file_status = SyncFileStatusToExtensionEnum(it->second.second); @@ -287,14 +287,14 @@ bool SyncFileSystemGetUsageAndQuotaFunction::RunAsync() { std::string url; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); - scoped_refptr<fileapi::FileSystemContext> file_system_context = + scoped_refptr<storage::FileSystemContext> file_system_context = BrowserContext::GetStoragePartition(GetProfile(), render_view_host()->GetSiteInstance()) ->GetFileSystemContext(); - fileapi::FileSystemURL file_system_url( + storage::FileSystemURL file_system_url( file_system_context->CrackURL(GURL(url))); - scoped_refptr<quota::QuotaManager> quota_manager = + scoped_refptr<storage::QuotaManager> quota_manager = BrowserContext::GetStoragePartition(GetProfile(), render_view_host()->GetSiteInstance()) ->GetQuotaManager(); @@ -302,10 +302,10 @@ bool SyncFileSystemGetUsageAndQuotaFunction::RunAsync() { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - Bind("a::QuotaManager::GetUsageAndQuotaForWebApps, + Bind(&storage::QuotaManager::GetUsageAndQuotaForWebApps, quota_manager, source_url().GetOrigin(), - fileapi::FileSystemTypeToQuotaStorageType(file_system_url.type()), + storage::FileSystemTypeToQuotaStorageType(file_system_url.type()), Bind(&SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota, this))); @@ -313,7 +313,9 @@ bool SyncFileSystemGetUsageAndQuotaFunction::RunAsync() { } void SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota( - quota::QuotaStatusCode status, int64 usage, int64 quota) { + storage::QuotaStatusCode status, + int64 usage, + int64 quota) { // Repost to switch from IO thread to UI thread for SendResponse(). if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -326,7 +328,7 @@ void SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota( } DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (status != quota::kQuotaStatusOk) { + if (status != storage::kQuotaStatusOk) { error_ = QuotaStatusCodeToString(status); SendResponse(false); return; diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h index e16fdce..c04944a 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h @@ -15,7 +15,7 @@ #include "webkit/browser/fileapi/file_system_url.h" #include "webkit/common/quota/quota_types.h" -namespace fileapi { +namespace storage { class FileSystemContext; } @@ -67,13 +67,13 @@ class SyncFileSystemGetFileStatusesFunction private: typedef std::pair<sync_file_system::SyncStatusCode, sync_file_system::SyncFileStatus> FileStatusPair; - typedef std::map<fileapi::FileSystemURL, FileStatusPair, - fileapi::FileSystemURL::Comparator> URLToStatusMap; + typedef std::map<storage::FileSystemURL, + FileStatusPair, + storage::FileSystemURL::Comparator> URLToStatusMap; - void DidGetFileStatus( - const fileapi::FileSystemURL& file_system_url, - sync_file_system::SyncStatusCode sync_status_code, - sync_file_system::SyncFileStatus sync_file_statuses); + void DidGetFileStatus(const storage::FileSystemURL& file_system_url, + sync_file_system::SyncStatusCode sync_status_code, + sync_file_system::SyncFileStatus sync_file_statuses); unsigned int num_expected_results_; unsigned int num_results_received_; @@ -91,7 +91,7 @@ class SyncFileSystemGetUsageAndQuotaFunction virtual bool RunAsync() OVERRIDE; private: - void DidGetUsageAndQuota(quota::QuotaStatusCode status, + void DidGetUsageAndQuota(storage::QuotaStatusCode status, int64 usage, int64 quota); }; @@ -110,7 +110,7 @@ class SyncFileSystemRequestFileSystemFunction typedef SyncFileSystemRequestFileSystemFunction self; // Returns the file system context for this extension. - fileapi::FileSystemContext* GetFileSystemContext(); + storage::FileSystemContext* GetFileSystemContext(); void DidOpenFileSystem(const GURL& root_url, const std::string& file_system_name, diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc index 724b689..e949823 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.cc @@ -106,16 +106,17 @@ ConflictResolutionPolicyToExtensionEnum( } base::DictionaryValue* CreateDictionaryValueForFileSystemEntry( - const fileapi::FileSystemURL& url, + const storage::FileSystemURL& url, sync_file_system::SyncFileType file_type) { if (!url.is_valid() || file_type == sync_file_system::SYNC_FILE_TYPE_UNKNOWN) return NULL; - std::string file_path = base::FilePath( - fileapi::VirtualPath::GetNormalizedFilePath(url.path())).AsUTF8Unsafe(); + std::string file_path = + base::FilePath(storage::VirtualPath::GetNormalizedFilePath(url.path())) + .AsUTF8Unsafe(); - std::string root_url = fileapi::GetFileSystemRootURI( - url.origin(), url.mount_type()).spec(); + std::string root_url = + storage::GetFileSystemRootURI(url.origin(), url.mount_type()).spec(); if (!url.filesystem_id().empty()) { root_url.append(url.filesystem_id()); root_url.append("/"); @@ -123,9 +124,9 @@ base::DictionaryValue* CreateDictionaryValueForFileSystemEntry( base::DictionaryValue* dict = new base::DictionaryValue; dict->SetString("fileSystemType", - fileapi::GetFileSystemTypeString(url.mount_type())); + storage::GetFileSystemTypeString(url.mount_type())); dict->SetString("fileSystemName", - fileapi::GetFileSystemName(url.origin(), url.type())); + storage::GetFileSystemName(url.origin(), url.type())); dict->SetString("rootUrl", root_url); dict->SetString("filePath", file_path); dict->SetBoolean("isDirectory", diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h index e2bf82c..1d0feab 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_api_helpers.h @@ -13,7 +13,7 @@ #include "chrome/browser/sync_file_system/sync_service_state.h" #include "chrome/common/extensions/api/sync_file_system.h" -namespace fileapi { +namespace storage { class FileSystemURL; } @@ -53,7 +53,7 @@ ExtensionEnumToConflictResolutionPolicy( // This returns NULL if the given |url| is not valid or |file_type| is // SYNC_FILE_TYPE_UNKNOWN. base::DictionaryValue* CreateDictionaryValueForFileSystemEntry( - const fileapi::FileSystemURL& url, + const storage::FileSystemURL& url, sync_file_system::SyncFileType file_type); } // namespace extensions diff --git a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc index 9877296..c76d5dc 100644 --- a/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc +++ b/chrome/browser/extensions/api/sync_file_system/sync_file_system_apitest.cc @@ -26,7 +26,7 @@ using ::testing::Eq; using ::testing::Ne; using ::testing::Property; using ::testing::Return; -using fileapi::FileSystemURL; +using storage::FileSystemURL; using sync_file_system::MockRemoteFileSyncService; using sync_file_system::RemoteFileSyncService; using sync_file_system::SyncFileSystemServiceFactory; @@ -44,19 +44,21 @@ class SyncFileSystemApiTest : public ExtensionApiTest { ExtensionApiTest::SetUpInProcessBrowserTestFixture(); real_minimum_preserved_space_ = - quota::QuotaManager::kMinimumPreserveForSystem; - quota::QuotaManager::kMinimumPreserveForSystem = 0; + storage::QuotaManager::kMinimumPreserveForSystem; + storage::QuotaManager::kMinimumPreserveForSystem = 0; // TODO(calvinlo): Update test code after default quota is made const // (http://crbug.com/155488). - real_default_quota_ = quota::QuotaManager::kSyncableStorageDefaultHostQuota; - quota::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; + real_default_quota_ = + storage::QuotaManager::kSyncableStorageDefaultHostQuota; + storage::QuotaManager::kSyncableStorageDefaultHostQuota = 123456; } virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { - quota::QuotaManager::kMinimumPreserveForSystem = + storage::QuotaManager::kMinimumPreserveForSystem = real_minimum_preserved_space_; - quota::QuotaManager::kSyncableStorageDefaultHostQuota = real_default_quota_; + storage::QuotaManager::kSyncableStorageDefaultHostQuota = + real_default_quota_; ExtensionApiTest::TearDownInProcessBrowserTestFixture(); } |