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

Side by Side Diff: webkit/fileapi/async_file_util_adapter.cc

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/async_file_util_adapter.h ('k') | webkit/fileapi/cross_operation_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "webkit/fileapi/async_file_util_adapter.h" 5 #include "webkit/fileapi/async_file_util_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "webkit/fileapi/file_system_context.h" 10 #include "webkit/fileapi/file_system_context.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 void ReplySnapshotFile( 71 void ReplySnapshotFile(
72 const AsyncFileUtil::CreateSnapshotFileCallback& callback) { 72 const AsyncFileUtil::CreateSnapshotFileCallback& callback) {
73 DCHECK(snapshot_policy_ != kSnapshotFileUnknown); 73 DCHECK(snapshot_policy_ != kSnapshotFileUnknown);
74 if (!callback.is_null()) 74 if (!callback.is_null())
75 callback.Run(error_, file_info_, platform_path_, snapshot_policy_); 75 callback.Run(error_, file_info_, platform_path_, snapshot_policy_);
76 } 76 }
77 77
78 private: 78 private:
79 base::PlatformFileError error_; 79 base::PlatformFileError error_;
80 base::PlatformFileInfo file_info_; 80 base::PlatformFileInfo file_info_;
81 FilePath platform_path_; 81 base::FilePath platform_path_;
82 SnapshotFilePolicy snapshot_policy_; 82 SnapshotFilePolicy snapshot_policy_;
83 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); 83 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper);
84 }; 84 };
85 85
86 class ReadDirectoryHelper { 86 class ReadDirectoryHelper {
87 public: 87 public:
88 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {} 88 ReadDirectoryHelper() : error_(base::PLATFORM_FILE_OK) {}
89 89
90 void RunWork(FileSystemFileUtil* file_util, 90 void RunWork(FileSystemFileUtil* file_util,
91 FileSystemOperationContext* context, 91 FileSystemOperationContext* context,
92 const FileSystemURL& url) { 92 const FileSystemURL& url) {
93 base::PlatformFileInfo file_info; 93 base::PlatformFileInfo file_info;
94 FilePath platform_path; 94 base::FilePath platform_path;
95 PlatformFileError error = file_util->GetFileInfo( 95 PlatformFileError error = file_util->GetFileInfo(
96 context, url, &file_info, &platform_path); 96 context, url, &file_info, &platform_path);
97 if (error != base::PLATFORM_FILE_OK) { 97 if (error != base::PLATFORM_FILE_OK) {
98 error_ = error; 98 error_ = error;
99 return; 99 return;
100 } 100 }
101 if (!file_info.is_directory) { 101 if (!file_info.is_directory) {
102 error_ = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; 102 error_ = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
103 return; 103 return;
104 } 104 }
105 105
106 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( 106 scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum(
107 file_util->CreateFileEnumerator(context, url, false /* recursive */)); 107 file_util->CreateFileEnumerator(context, url, false /* recursive */));
108 108
109 FilePath current; 109 base::FilePath current;
110 while (!(current = file_enum->Next()).empty()) { 110 while (!(current = file_enum->Next()).empty()) {
111 AsyncFileUtil::Entry entry; 111 AsyncFileUtil::Entry entry;
112 entry.is_directory = file_enum->IsDirectory(); 112 entry.is_directory = file_enum->IsDirectory();
113 entry.name = VirtualPath::BaseName(current).value(); 113 entry.name = VirtualPath::BaseName(current).value();
114 entry.size = file_enum->Size(); 114 entry.size = file_enum->Size();
115 entry.last_modified_time = file_enum->LastModifiedTime(); 115 entry.last_modified_time = file_enum->LastModifiedTime();
116 entries_.push_back(entry); 116 entries_.push_back(entry);
117 } 117 }
118 error_ = base::PLATFORM_FILE_OK; 118 error_ = base::PLATFORM_FILE_OK;
119 } 119 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 return base::PostTaskAndReplyWithResult( 250 return base::PostTaskAndReplyWithResult(
251 context->task_runner(), FROM_HERE, 251 context->task_runner(), FROM_HERE,
252 Bind(&FileSystemFileUtil::CopyOrMoveFile, 252 Bind(&FileSystemFileUtil::CopyOrMoveFile,
253 Unretained(sync_file_util_.get()), 253 Unretained(sync_file_util_.get()),
254 context, src_url, dest_url, false /* copy */), 254 context, src_url, dest_url, false /* copy */),
255 callback); 255 callback);
256 } 256 }
257 257
258 bool AsyncFileUtilAdapter::CopyInForeignFile( 258 bool AsyncFileUtilAdapter::CopyInForeignFile(
259 FileSystemOperationContext* context, 259 FileSystemOperationContext* context,
260 const FilePath& src_file_path, 260 const base::FilePath& src_file_path,
261 const FileSystemURL& dest_url, 261 const FileSystemURL& dest_url,
262 const StatusCallback& callback) { 262 const StatusCallback& callback) {
263 return base::PostTaskAndReplyWithResult( 263 return base::PostTaskAndReplyWithResult(
264 context->task_runner(), FROM_HERE, 264 context->task_runner(), FROM_HERE,
265 Bind(&FileSystemFileUtil::CopyInForeignFile, 265 Bind(&FileSystemFileUtil::CopyInForeignFile,
266 Unretained(sync_file_util_.get()), 266 Unretained(sync_file_util_.get()),
267 context, src_file_path, dest_url), 267 context, src_file_path, dest_url),
268 callback); 268 callback);
269 } 269 }
270 270
(...skipping 26 matching lines...) Expand all
297 const CreateSnapshotFileCallback& callback) { 297 const CreateSnapshotFileCallback& callback) {
298 GetFileInfoHelper* helper = new GetFileInfoHelper; 298 GetFileInfoHelper* helper = new GetFileInfoHelper;
299 return context->task_runner()->PostTaskAndReply( 299 return context->task_runner()->PostTaskAndReply(
300 FROM_HERE, 300 FROM_HERE,
301 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), 301 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper),
302 sync_file_util_.get(), context, url), 302 sync_file_util_.get(), context, url),
303 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); 303 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback));
304 } 304 }
305 305
306 } // namespace fileapi 306 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/async_file_util_adapter.h ('k') | webkit/fileapi/cross_operation_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698