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 <stddef.h> |
| 8 |
7 #include <limits> | 9 #include <limits> |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
11 #include "chrome/common/extensions/api/file_system_provider.h" | 13 #include "chrome/common/extensions/api/file_system_provider.h" |
12 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 14 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
13 | 15 |
14 namespace chromeos { | 16 namespace chromeos { |
15 namespace file_system_provider { | 17 namespace file_system_provider { |
16 namespace operations { | 18 namespace operations { |
(...skipping 23 matching lines...) Expand all Loading... |
40 return chunk_size; | 42 return chunk_size; |
41 } | 43 } |
42 | 44 |
43 } // namespace | 45 } // namespace |
44 | 46 |
45 ReadFile::ReadFile( | 47 ReadFile::ReadFile( |
46 extensions::EventRouter* event_router, | 48 extensions::EventRouter* event_router, |
47 const ProvidedFileSystemInfo& file_system_info, | 49 const ProvidedFileSystemInfo& file_system_info, |
48 int file_handle, | 50 int file_handle, |
49 scoped_refptr<net::IOBuffer> buffer, | 51 scoped_refptr<net::IOBuffer> buffer, |
50 int64 offset, | 52 int64_t offset, |
51 int length, | 53 int length, |
52 const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) | 54 const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) |
53 : Operation(event_router, file_system_info), | 55 : Operation(event_router, file_system_info), |
54 file_handle_(file_handle), | 56 file_handle_(file_handle), |
55 buffer_(buffer), | 57 buffer_(buffer), |
56 offset_(offset), | 58 offset_(offset), |
57 length_(length), | 59 length_(length), |
58 current_offset_(0), | 60 current_offset_(0), |
59 callback_(callback) { | 61 callback_(callback) {} |
60 } | |
61 | 62 |
62 ReadFile::~ReadFile() { | 63 ReadFile::~ReadFile() { |
63 } | 64 } |
64 | 65 |
65 bool ReadFile::Execute(int request_id) { | 66 bool ReadFile::Execute(int request_id) { |
66 using extensions::api::file_system_provider::ReadFileRequestedOptions; | 67 using extensions::api::file_system_provider::ReadFileRequestedOptions; |
67 TRACE_EVENT0("file_system_provider", "ReadFile::Execute"); | 68 TRACE_EVENT0("file_system_provider", "ReadFile::Execute"); |
68 | 69 |
69 ReadFileRequestedOptions options; | 70 ReadFileRequestedOptions options; |
70 options.file_system_id = file_system_info_.file_system_id(); | 71 options.file_system_id = file_system_info_.file_system_id(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void ReadFile::OnError(int /* request_id */, | 104 void ReadFile::OnError(int /* request_id */, |
104 scoped_ptr<RequestValue> /* result */, | 105 scoped_ptr<RequestValue> /* result */, |
105 base::File::Error error) { | 106 base::File::Error error) { |
106 TRACE_EVENT0("file_system_provider", "ReadFile::OnError"); | 107 TRACE_EVENT0("file_system_provider", "ReadFile::OnError"); |
107 callback_.Run(0 /* chunk_length */, false /* has_more */, error); | 108 callback_.Run(0 /* chunk_length */, false /* has_more */, error); |
108 } | 109 } |
109 | 110 |
110 } // namespace operations | 111 } // namespace operations |
111 } // namespace file_system_provider | 112 } // namespace file_system_provider |
112 } // namespace chromeos | 113 } // namespace chromeos |
OLD | NEW |