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

Unified Diff: chrome/browser/sync_file_system/local/canned_syncable_file_system.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index 7f15131c017854f980d5b151fba481bc7ce71b8f..12e9470d330cec4f9679d5b05f6cac067b87fa0d 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/file_util.h"
+#include "base/files/file.h"
#include "base/guid.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
@@ -32,7 +33,7 @@
#include "webkit/browser/quota/quota_manager.h"
#include "webkit/common/blob/shareable_file_reference.h"
-using base::PlatformFileError;
+using base::File;
using fileapi::FileSystemContext;
using fileapi::FileSystemOperationRunner;
using fileapi::FileSystemURL;
@@ -98,11 +99,11 @@ void VerifySameTaskRunner(
void OnCreateSnapshotFileAndVerifyData(
const std::string& expected_data,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& /* file_ref */) {
- if (result != base::PLATFORM_FILE_OK) {
+ if (result != base::File::FILE_OK) {
callback.Run(result);
return;
}
@@ -115,11 +116,11 @@ void OnCreateSnapshotFileAndVerifyData(
}
void OnCreateSnapshotFile(
- base::PlatformFileInfo* file_info_out,
+ base::File::Info* file_info_out,
base::FilePath* platform_path_out,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
DCHECK(!file_ref.get());
@@ -133,7 +134,7 @@ void OnCreateSnapshotFile(
void OnReadDirectory(
CannedSyncableFileSystem::FileEntryList* entries_out,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError error,
+ base::File::Error error,
const fileapi::FileSystemOperation::FileEntryList& entries,
bool has_more) {
DCHECK(entries_out);
@@ -166,14 +167,14 @@ class WriteHelper {
ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
void DidWrite(const base::Callback<void(int64 result)>& completion_callback,
- PlatformFileError error, int64 bytes, bool complete) {
- if (error == base::PLATFORM_FILE_OK) {
+ File::Error error, int64 bytes, bool complete) {
+ if (error == base::File::FILE_OK) {
bytes_written_ += bytes;
if (!complete)
return;
}
- completion_callback.Run(error == base::PLATFORM_FILE_OK
- ? bytes_written_ : static_cast<int64>(error));
+ completion_callback.Run(error == base::File::FILE_OK ?
+ bytes_written_ : static_cast<int64>(error));
}
private:
@@ -208,7 +209,7 @@ CannedSyncableFileSystem::CannedSyncableFileSystem(
base::SingleThreadTaskRunner* file_task_runner)
: origin_(origin),
type_(fileapi::kFileSystemTypeSyncable),
- result_(base::PLATFORM_FILE_OK),
+ result_(base::File::FILE_OK),
sync_status_(sync_file_system::SYNC_STATUS_OK),
io_task_runner_(io_task_runner),
file_task_runner_(file_task_runner),
@@ -270,7 +271,7 @@ FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const {
return file_system_context_->CrackURL(url);
}
-PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
+File::Error CannedSyncableFileSystem::OpenFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
io_task_runner_->PostTask(
@@ -318,9 +319,9 @@ SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext(
return sync_status_;
}
-PlatformFileError CannedSyncableFileSystem::CreateDirectory(
+File::Error CannedSyncableFileSystem::CreateDirectory(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateDirectory,
@@ -328,9 +329,8 @@ PlatformFileError CannedSyncableFileSystem::CreateDirectory(
url));
}
-PlatformFileError CannedSyncableFileSystem::CreateFile(
- const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+File::Error CannedSyncableFileSystem::CreateFile(const FileSystemURL& url) {
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateFile,
@@ -338,9 +338,9 @@ PlatformFileError CannedSyncableFileSystem::CreateFile(
url));
}
-PlatformFileError CannedSyncableFileSystem::Copy(
+File::Error CannedSyncableFileSystem::Copy(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCopy,
@@ -349,9 +349,9 @@ PlatformFileError CannedSyncableFileSystem::Copy(
dest_url));
}
-PlatformFileError CannedSyncableFileSystem::Move(
+File::Error CannedSyncableFileSystem::Move(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoMove,
@@ -360,9 +360,9 @@ PlatformFileError CannedSyncableFileSystem::Move(
dest_url));
}
-PlatformFileError CannedSyncableFileSystem::TruncateFile(
+File::Error CannedSyncableFileSystem::TruncateFile(
const FileSystemURL& url, int64 size) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTruncateFile,
@@ -371,11 +371,11 @@ PlatformFileError CannedSyncableFileSystem::TruncateFile(
size));
}
-PlatformFileError CannedSyncableFileSystem::TouchFile(
+File::Error CannedSyncableFileSystem::TouchFile(
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTouchFile,
@@ -385,9 +385,9 @@ PlatformFileError CannedSyncableFileSystem::TouchFile(
last_modified_time));
}
-PlatformFileError CannedSyncableFileSystem::Remove(
+File::Error CannedSyncableFileSystem::Remove(
const FileSystemURL& url, bool recursive) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoRemove,
@@ -396,9 +396,9 @@ PlatformFileError CannedSyncableFileSystem::Remove(
recursive));
}
-PlatformFileError CannedSyncableFileSystem::FileExists(
+File::Error CannedSyncableFileSystem::FileExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoFileExists,
@@ -406,9 +406,9 @@ PlatformFileError CannedSyncableFileSystem::FileExists(
url));
}
-PlatformFileError CannedSyncableFileSystem::DirectoryExists(
+File::Error CannedSyncableFileSystem::DirectoryExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoDirectoryExists,
@@ -416,10 +416,10 @@ PlatformFileError CannedSyncableFileSystem::DirectoryExists(
url));
}
-PlatformFileError CannedSyncableFileSystem::VerifyFile(
+File::Error CannedSyncableFileSystem::VerifyFile(
const FileSystemURL& url,
const std::string& expected_data) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoVerifyFile,
@@ -428,11 +428,11 @@ PlatformFileError CannedSyncableFileSystem::VerifyFile(
expected_data));
}
-PlatformFileError CannedSyncableFileSystem::GetMetadataAndPlatformPath(
+File::Error CannedSyncableFileSystem::GetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath,
@@ -442,10 +442,10 @@ PlatformFileError CannedSyncableFileSystem::GetMetadataAndPlatformPath(
platform_path));
}
-PlatformFileError CannedSyncableFileSystem::ReadDirectory(
+File::Error CannedSyncableFileSystem::ReadDirectory(
const fileapi::FileSystemURL& url,
FileEntryList* entries) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoReadDirectory,
@@ -477,9 +477,9 @@ int64 CannedSyncableFileSystem::WriteString(
data));
}
-PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() {
+File::Error CannedSyncableFileSystem::DeleteFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&FileSystemContext::DeleteFileSystem,
@@ -651,7 +651,7 @@ void CannedSyncableFileSystem::DoVerifyFile(
void CannedSyncableFileSystem::DoGetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path,
const StatusCallback& callback) {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
@@ -714,7 +714,7 @@ void CannedSyncableFileSystem::DidOpenFileSystem(
base::SingleThreadTaskRunner* original_task_runner,
const GURL& root,
const std::string& name,
- PlatformFileError result) {
+ File::Error result) {
if (io_task_runner_->RunsTasksOnCurrentThread()) {
EXPECT_FALSE(is_filesystem_opened_);
is_filesystem_opened_ = true;

Powered by Google App Engine
This is Rietveld 408576698