OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/browser/fileapi/file_system_operation_runner.h" | 5 #include "storage/browser/fileapi/file_system_operation_runner.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 PrepareForRead(handle.id, url); | 168 PrepareForRead(handle.id, url); |
169 operation->FileExists( | 169 operation->FileExists( |
170 url, | 170 url, |
171 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), | 171 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), |
172 handle, callback)); | 172 handle, callback)); |
173 return handle.id; | 173 return handle.id; |
174 } | 174 } |
175 | 175 |
176 OperationID FileSystemOperationRunner::GetMetadata( | 176 OperationID FileSystemOperationRunner::GetMetadata( |
177 const FileSystemURL& url, | 177 const FileSystemURL& url, |
| 178 int fields, |
178 const GetMetadataCallback& callback) { | 179 const GetMetadataCallback& callback) { |
179 base::File::Error error = base::File::FILE_OK; | 180 base::File::Error error = base::File::FILE_OK; |
180 FileSystemOperation* operation = | 181 FileSystemOperation* operation = |
181 file_system_context_->CreateFileSystemOperation(url, &error); | 182 file_system_context_->CreateFileSystemOperation(url, &error); |
182 BeginOperationScoper scope; | 183 BeginOperationScoper scope; |
183 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); | 184 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); |
184 if (!operation) { | 185 if (!operation) { |
185 DidGetMetadata(handle, callback, error, base::File::Info()); | 186 DidGetMetadata(handle, callback, error, base::File::Info()); |
186 return handle.id; | 187 return handle.id; |
187 } | 188 } |
188 PrepareForRead(handle.id, url); | 189 PrepareForRead(handle.id, url); |
189 operation->GetMetadata( | 190 operation->GetMetadata(url, fields, |
190 url, | 191 base::Bind(&FileSystemOperationRunner::DidGetMetadata, |
191 base::Bind(&FileSystemOperationRunner::DidGetMetadata, AsWeakPtr(), | 192 AsWeakPtr(), handle, callback)); |
192 handle, callback)); | |
193 return handle.id; | 193 return handle.id; |
194 } | 194 } |
195 | 195 |
196 OperationID FileSystemOperationRunner::ReadDirectory( | 196 OperationID FileSystemOperationRunner::ReadDirectory( |
197 const FileSystemURL& url, | 197 const FileSystemURL& url, |
198 const ReadDirectoryCallback& callback) { | 198 const ReadDirectoryCallback& callback) { |
199 base::File::Error error = base::File::FILE_OK; | 199 base::File::Error error = base::File::FILE_OK; |
200 FileSystemOperation* operation = | 200 FileSystemOperation* operation = |
201 file_system_context_->CreateFileSystemOperation(url, &error); | 201 file_system_context_->CreateFileSystemOperation(url, &error); |
202 BeginOperationScoper scope; | 202 BeginOperationScoper scope; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 stray_cancel_callbacks_.find(id); | 680 stray_cancel_callbacks_.find(id); |
681 if (found_cancel != stray_cancel_callbacks_.end()) { | 681 if (found_cancel != stray_cancel_callbacks_.end()) { |
682 // This cancel has been requested after the operation has finished, | 682 // This cancel has been requested after the operation has finished, |
683 // so report that we failed to stop it. | 683 // so report that we failed to stop it. |
684 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 684 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
685 stray_cancel_callbacks_.erase(found_cancel); | 685 stray_cancel_callbacks_.erase(found_cancel); |
686 } | 686 } |
687 } | 687 } |
688 | 688 |
689 } // namespace storage | 689 } // namespace storage |
OLD | NEW |