| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 values->AppendDouble(offset_); | 67 values->AppendDouble(offset_); |
| 68 values->AppendInteger(length_); | 68 values->AppendInteger(length_); |
| 69 return SendEvent( | 69 return SendEvent( |
| 70 request_id, | 70 request_id, |
| 71 extensions::api::file_system_provider::OnReadFileRequested::kEventName, | 71 extensions::api::file_system_provider::OnReadFileRequested::kEventName, |
| 72 values.Pass()); | 72 values.Pass()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void ReadFile::OnSuccess(int /* request_id */, | 75 void ReadFile::OnSuccess(int /* request_id */, |
| 76 scoped_ptr<RequestValue> result, | 76 scoped_ptr<RequestValue> result, |
| 77 bool has_next) { | 77 bool has_more) { |
| 78 const int copy_result = CopyRequestValueToBuffer( | 78 const int copy_result = CopyRequestValueToBuffer( |
| 79 result.Pass(), buffer_, current_offset_, length_); | 79 result.Pass(), buffer_, current_offset_, length_); |
| 80 DCHECK_LE(0, copy_result); | 80 DCHECK_LE(0, copy_result); |
| 81 DCHECK(!has_next || copy_result > 0); | 81 DCHECK(!has_more || copy_result > 0); |
| 82 if (copy_result > 0) | 82 if (copy_result > 0) |
| 83 current_offset_ += copy_result; | 83 current_offset_ += copy_result; |
| 84 callback_.Run(copy_result, has_next, base::File::FILE_OK); | 84 callback_.Run(copy_result, has_more, 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_more */, 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 |