| Index: chrome/browser/chromeos/file_system_provider/operations/read_file.cc
|
| diff --git a/chrome/browser/chromeos/file_system_provider/operations/read_file.cc b/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
|
| index 20bfa46c23d256a08a18a94a5c1e8ad273a572e6..d69cfcc825549ed433735e39985d0cee0879605d 100644
|
| --- a/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
|
| +++ b/chrome/browser/chromeos/file_system_provider/operations/read_file.cc
|
| @@ -44,15 +44,16 @@ int CopyRequestValueToBuffer(scoped_ptr<RequestValue> value,
|
|
|
| } // namespace
|
|
|
| -ReadFile::ReadFile(
|
| - extensions::EventRouter* event_router,
|
| +template <class DestinationPolicy>
|
| +ReadFile<DestinationPolicy>::ReadFile(
|
| + typename DestinationPolicy::EventRouterType* event_router,
|
| const ProvidedFileSystemInfo& file_system_info,
|
| int file_handle,
|
| scoped_refptr<net::IOBuffer> buffer,
|
| int64 offset,
|
| int length,
|
| const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback)
|
| - : Operation(event_router, file_system_info),
|
| + : Operation<DestinationPolicy>(event_router, file_system_info),
|
| file_handle_(file_handle),
|
| buffer_(buffer),
|
| offset_(offset),
|
| @@ -61,30 +62,33 @@ ReadFile::ReadFile(
|
| callback_(callback) {
|
| }
|
|
|
| -ReadFile::~ReadFile() {
|
| +template <class DestinationPolicy>
|
| +ReadFile<DestinationPolicy>::~ReadFile() {
|
| }
|
|
|
| -bool ReadFile::Execute(int request_id) {
|
| +template <class DestinationPolicy>
|
| +bool ReadFile<DestinationPolicy>::Execute(int request_id) {
|
| using extensions::api::file_system_provider::ReadFileRequestedOptions;
|
| TRACE_EVENT0("file_system_provider", "ReadFile::Execute");
|
|
|
| ReadFileRequestedOptions 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.open_request_id = file_handle_;
|
| options.offset = offset_;
|
| options.length = length_;
|
|
|
| - return SendEvent(
|
| + return this->SendEvent(
|
| request_id,
|
| extensions::api::file_system_provider::OnReadFileRequested::kEventName,
|
| extensions::api::file_system_provider::OnReadFileRequested::Create(
|
| options));
|
| }
|
|
|
| -void ReadFile::OnSuccess(int /* request_id */,
|
| - scoped_ptr<RequestValue> result,
|
| - bool has_more) {
|
| +template <class DestinationPolicy>
|
| +void ReadFile<DestinationPolicy>::OnSuccess(int /* request_id */,
|
| + scoped_ptr<RequestValue> result,
|
| + bool has_more) {
|
| TRACE_EVENT0("file_system_provider", "ReadFile::OnSuccess");
|
| const int copy_result = CopyRequestValueToBuffer(
|
| result.Pass(), buffer_, current_offset_, length_);
|
| @@ -101,13 +105,16 @@ void ReadFile::OnSuccess(int /* request_id */,
|
| callback_.Run(copy_result, has_more, base::File::FILE_OK);
|
| }
|
|
|
| -void ReadFile::OnError(int /* request_id */,
|
| - scoped_ptr<RequestValue> /* result */,
|
| - base::File::Error error) {
|
| +template <class DestinationPolicy>
|
| +void ReadFile<DestinationPolicy>::OnError(int /* request_id */,
|
| + scoped_ptr<RequestValue> /* result */,
|
| + base::File::Error error) {
|
| TRACE_EVENT0("file_system_provider", "ReadFile::OnError");
|
| callback_.Run(0 /* chunk_length */, false /* has_more */, error);
|
| }
|
|
|
| +FOR_EACH_DESTINATION_SPECIALIZE(ReadFile)
|
| +
|
| } // namespace operations
|
| } // namespace file_system_provider
|
| } // namespace chromeos
|
|
|