Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: storage/browser/fileapi/file_system_operation_runner.cc

Issue 1455403003: Add an option to specify requested fields for fetching metadata. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « storage/browser/fileapi/file_system_operation_runner.h ('k') | storage/browser/fileapi/file_system_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698