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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/open_file.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/open_file.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/open_file.cc b/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
index ecd626f8b533d0273697480d1bfec982c532d706..caf1913d685d6b712bab98f0853e3a7b55fb1b34 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/open_file.cc
@@ -13,30 +13,33 @@ namespace chromeos {
namespace file_system_provider {
namespace operations {
-OpenFile::OpenFile(
- extensions::EventRouter* event_router,
+template <class DestinationPolicy>
+OpenFile<DestinationPolicy>::OpenFile(
+ typename DestinationPolicy::EventRouterType* event_router,
const ProvidedFileSystemInfo& file_system_info,
const base::FilePath& file_path,
OpenFileMode mode,
const ProvidedFileSystemInterface::OpenFileCallback& callback)
- : Operation(event_router, file_system_info),
+ : Operation<DestinationPolicy>(event_router, file_system_info),
file_path_(file_path),
mode_(mode),
callback_(callback) {
}
-OpenFile::~OpenFile() {
+template <class DestinationPolicy>
+OpenFile<DestinationPolicy>::~OpenFile() {
}
-bool OpenFile::Execute(int request_id) {
+template <class DestinationPolicy>
+bool OpenFile<DestinationPolicy>::Execute(int request_id) {
using extensions::api::file_system_provider::OpenFileRequestedOptions;
- if (!file_system_info_.writable() && mode_ == OPEN_FILE_MODE_WRITE) {
+ if (!this->file_system_info_.writable() && mode_ == OPEN_FILE_MODE_WRITE) {
return false;
}
OpenFileRequestedOptions 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();
@@ -50,26 +53,30 @@ bool OpenFile::Execute(int request_id) {
break;
}
- return SendEvent(
+ return this->SendEvent(
request_id,
extensions::api::file_system_provider::OnOpenFileRequested::kEventName,
extensions::api::file_system_provider::OnOpenFileRequested::Create(
options));
}
-void OpenFile::OnSuccess(int request_id,
- scoped_ptr<RequestValue> result,
- bool has_more) {
+template <class DestinationPolicy>
+void OpenFile<DestinationPolicy>::OnSuccess(int request_id,
+ scoped_ptr<RequestValue> result,
+ bool has_more) {
// File handle is the same as request id of the OpenFile operation.
callback_.Run(request_id, base::File::FILE_OK);
}
-void OpenFile::OnError(int /* request_id */,
- scoped_ptr<RequestValue> /* result */,
- base::File::Error error) {
+template <class DestinationPolicy>
+void OpenFile<DestinationPolicy>::OnError(int /* request_id */,
+ scoped_ptr<RequestValue> /* result */,
+ base::File::Error error) {
callback_.Run(0 /* file_handle */, error);
}
+FOR_EACH_DESTINATION_SPECIALIZE(OpenFile)
+
} // namespace operations
} // namespace file_system_provider
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698