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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/truncate.cc

Issue 417983002: [fsp] Add support for truncating files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 5 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/chromeos/file_system_provider/operations/truncate.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/create_file.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate.cc
similarity index 56%
copy from chrome/browser/chromeos/file_system_provider/operations/create_file.cc
copy to chrome/browser/chromeos/file_system_provider/operations/truncate.cc
index 9f861c780294981bc9de05eb46b3f89bc87270d4..c7537a46aab256a219df3fa2ef1185f82831a4bd 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/create_file.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/truncate.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/file_system_provider/operations/create_file.h"
+#include "chrome/browser/chromeos/file_system_provider/operations/truncate.h"
#include <string>
@@ -13,37 +13,40 @@ namespace chromeos {
namespace file_system_provider {
namespace operations {
-CreateFile::CreateFile(extensions::EventRouter* event_router,
- const ProvidedFileSystemInfo& file_system_info,
- const base::FilePath& file_path,
- const fileapi::AsyncFileUtil::StatusCallback& callback)
+Truncate::Truncate(extensions::EventRouter* event_router,
+ const ProvidedFileSystemInfo& file_system_info,
+ const base::FilePath& file_path,
+ int64 length,
+ const fileapi::AsyncFileUtil::StatusCallback& callback)
: Operation(event_router, file_system_info),
file_path_(file_path),
+ length_(length),
callback_(callback) {
}
-CreateFile::~CreateFile() {
+Truncate::~Truncate() {
}
-bool CreateFile::Execute(int request_id) {
+bool Truncate::Execute(int request_id) {
scoped_ptr<base::DictionaryValue> values(new base::DictionaryValue);
values->SetString("filePath", file_path_.AsUTF8Unsafe());
+ values->SetDouble("length", length_);
return SendEvent(
request_id,
- extensions::api::file_system_provider::OnCreateFileRequested::kEventName,
+ extensions::api::file_system_provider::OnTruncateRequested::kEventName,
values.Pass());
}
-void CreateFile::OnSuccess(int /* request_id */,
- scoped_ptr<RequestValue> /* result */,
- bool has_more) {
+void Truncate::OnSuccess(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ bool has_more) {
callback_.Run(base::File::FILE_OK);
}
-void CreateFile::OnError(int /* request_id */,
- scoped_ptr<RequestValue> /* result */,
- base::File::Error error) {
+void Truncate::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(error);
}

Powered by Google App Engine
This is Rietveld 408576698