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

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

Issue 1093383002: [WIP] Provided file system from NACL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved several modules to chromeos folder. Created 5 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/truncate.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate.cc
index cd5cdcf6480a875f9631a454de24aa49e5c781be..06b8af5fd1b93fb2de79b0ed4ba6ca2c3eb4d41e 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/truncate.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/truncate.cc
@@ -13,51 +13,59 @@ namespace chromeos {
namespace file_system_provider {
namespace operations {
-Truncate::Truncate(extensions::EventRouter* event_router,
- const ProvidedFileSystemInfo& file_system_info,
- const base::FilePath& file_path,
- int64 length,
- const storage::AsyncFileUtil::StatusCallback& callback)
- : Operation(event_router, file_system_info),
+template <class DestinationPolicy>
+Truncate<DestinationPolicy>::Truncate(
+ typename DestinationPolicy::EventRouterType* event_router,
+ const ProvidedFileSystemInfo& file_system_info,
+ const base::FilePath& file_path,
+ int64 length,
+ const storage::AsyncFileUtil::StatusCallback& callback)
+ : Operation<DestinationPolicy>(event_router, file_system_info),
file_path_(file_path),
length_(length),
callback_(callback) {
}
-Truncate::~Truncate() {
+template <class DestinationPolicy>
+Truncate<DestinationPolicy>::~Truncate() {
}
-bool Truncate::Execute(int request_id) {
+template <class DestinationPolicy>
+bool Truncate<DestinationPolicy>::Execute(int request_id) {
using extensions::api::file_system_provider::TruncateRequestedOptions;
- if (!file_system_info_.writable())
+ if (!this->file_system_info_.writable())
return false;
TruncateRequestedOptions options;
- options.file_system_id = file_system_info_.file_system_id();
+ options.file_system_id = this->file_system_info_.file_system_id();
options.request_id = request_id;
options.file_path = file_path_.AsUTF8Unsafe();
options.length = length_;
- return SendEvent(
+ return this->SendEvent(
request_id,
extensions::api::file_system_provider::OnTruncateRequested::kEventName,
extensions::api::file_system_provider::OnTruncateRequested::Create(
options));
}
-void Truncate::OnSuccess(int /* request_id */,
- scoped_ptr<RequestValue> /* result */,
- bool has_more) {
+template <class DestinationPolicy>
+void Truncate<DestinationPolicy>::OnSuccess(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ bool has_more) {
callback_.Run(base::File::FILE_OK);
}
-void Truncate::OnError(int /* request_id */,
- scoped_ptr<RequestValue> /* result */,
- base::File::Error error) {
+template <class DestinationPolicy>
+void Truncate<DestinationPolicy>::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(error);
}
+FOR_EACH_DESTINATION_SPECIALIZE(Truncate)
+
} // namespace operations
} // namespace file_system_provider
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698