OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/read_file.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/common/extensions/api/file_system_provider.h" | 10 #include "chrome/common/extensions/api/file_system_provider.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 int file_handle, | 47 int file_handle, |
48 net::IOBuffer* buffer, | 48 net::IOBuffer* buffer, |
49 int64 offset, | 49 int64 offset, |
50 int length, | 50 int length, |
51 const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) | 51 const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) |
52 : Operation(event_router, file_system_info), | 52 : Operation(event_router, file_system_info), |
53 file_handle_(file_handle), | 53 file_handle_(file_handle), |
54 buffer_(buffer), | 54 buffer_(buffer), |
55 offset_(offset), | 55 offset_(offset), |
56 length_(length), | 56 length_(length), |
57 current_offset_(offset), | 57 current_offset_(0), |
58 callback_(callback) { | 58 callback_(callback) { |
59 } | 59 } |
60 | 60 |
61 ReadFile::~ReadFile() { | 61 ReadFile::~ReadFile() { |
62 } | 62 } |
63 | 63 |
64 bool ReadFile::Execute(int request_id) { | 64 bool ReadFile::Execute(int request_id) { |
65 scoped_ptr<base::ListValue> values(new base::ListValue); | 65 scoped_ptr<base::ListValue> values(new base::ListValue); |
66 values->AppendInteger(file_handle_); | 66 values->AppendInteger(file_handle_); |
67 values->AppendDouble(offset_); | 67 values->AppendDouble(offset_); |
(...skipping 16 matching lines...) Expand all Loading... |
84 callback_.Run(copy_result, has_next, base::File::FILE_OK); | 84 callback_.Run(copy_result, has_next, base::File::FILE_OK); |
85 } | 85 } |
86 | 86 |
87 void ReadFile::OnError(int /* request_id */, base::File::Error error) { | 87 void ReadFile::OnError(int /* request_id */, base::File::Error error) { |
88 callback_.Run(0 /* chunk_length */, false /* has_next */, error); | 88 callback_.Run(0 /* chunk_length */, false /* has_next */, error); |
89 } | 89 } |
90 | 90 |
91 } // namespace operations | 91 } // namespace operations |
92 } // namespace file_system_provider | 92 } // namespace file_system_provider |
93 } // namespace chromeos | 93 } // namespace chromeos |
OLD | NEW |