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

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

Issue 7149008: Cleanup: base/scoped_ptr.h -> base/memory/scoped_ptr.h. (part 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix nits Created 9 years, 6 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/file_system_file_util.h" 5 #include "webkit/fileapi/file_system_file_util.h"
6 6
7 #include <stack> 7 #include <stack>
8 #include <vector>
8 9
9 #include "base/file_util_proxy.h" 10 #include "base/file_util_proxy.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "webkit/fileapi/file_system_operation_context.h" 13 #include "webkit/fileapi/file_system_operation_context.h"
13 14
14 namespace fileapi { 15 namespace fileapi {
15 16
16 namespace { 17 namespace {
17 18
18 // This assumes that the root exists. 19 // This assumes that the root exists.
19 bool ParentExists(FileSystemOperationContext* context, 20 bool ParentExists(FileSystemOperationContext* context,
20 FileSystemFileUtil* file_util, const FilePath& file_path) { 21 FileSystemFileUtil* file_util, const FilePath& file_path) {
21 // If file_path is in the root, file_path.DirName() will be ".", 22 // If file_path is in the root, file_path.DirName() will be ".",
22 // since we use paths with no leading '/'. 23 // since we use paths with no leading '/'.
23 FilePath parent = file_path.DirName(); 24 FilePath parent = file_path.DirName();
24 if (parent == FilePath(FILE_PATH_LITERAL("."))) 25 if (parent == FilePath(FILE_PATH_LITERAL(".")))
25 return true; 26 return true;
26 return file_util->DirectoryExists(context, parent); 27 return file_util->DirectoryExists(context, parent);
27 } 28 }
28 29
29 } 30 } // namespace
30 31
31 // static 32 // static
32 FileSystemFileUtil* FileSystemFileUtil::GetInstance() { 33 FileSystemFileUtil* FileSystemFileUtil::GetInstance() {
33 return Singleton<FileSystemFileUtil>::get(); 34 return Singleton<FileSystemFileUtil>::get();
34 } 35 }
35 36
36 PlatformFileError FileSystemFileUtil::CreateOrOpen( 37 PlatformFileError FileSystemFileUtil::CreateOrOpen(
37 FileSystemOperationContext* unused, 38 FileSystemOperationContext* unused,
38 const FilePath& file_path, int file_flags, 39 const FilePath& file_path, int file_flags,
39 PlatformFile* file_handle, bool* created) { 40 PlatformFile* file_handle, bool* created) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 PlatformFileError FileSystemFileUtil::Delete( 200 PlatformFileError FileSystemFileUtil::Delete(
200 FileSystemOperationContext* context, 201 FileSystemOperationContext* context,
201 const FilePath& file_path, 202 const FilePath& file_path,
202 bool recursive) { 203 bool recursive) {
203 if (DirectoryExists(context, file_path)) { 204 if (DirectoryExists(context, file_path)) {
204 if (!recursive) 205 if (!recursive)
205 return DeleteSingleDirectory(context, file_path); 206 return DeleteSingleDirectory(context, file_path);
206 else 207 else
207 return DeleteDirectoryRecursive(context, file_path); 208 return DeleteDirectoryRecursive(context, file_path);
208 } else 209 } else {
209 return DeleteFile(context, file_path); 210 return DeleteFile(context, file_path);
211 }
210 } 212 }
211 213
212 PlatformFileError FileSystemFileUtil::Touch( 214 PlatformFileError FileSystemFileUtil::Touch(
213 FileSystemOperationContext* unused, 215 FileSystemOperationContext* unused,
214 const FilePath& file_path, 216 const FilePath& file_path,
215 const base::Time& last_access_time, 217 const base::Time& last_access_time,
216 const base::Time& last_modified_time) { 218 const base::Time& last_modified_time) {
217 if (!file_util::TouchFile( 219 if (!file_util::TouchFile(
218 file_path, last_access_time, last_modified_time)) 220 file_path, last_access_time, last_modified_time))
219 return base::PLATFORM_FILE_ERROR_FAILED; 221 return base::PLATFORM_FILE_ERROR_FAILED;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 FileSystemFileUtil::CreateFileEnumerator( 543 FileSystemFileUtil::CreateFileEnumerator(
542 FileSystemOperationContext* unused, 544 FileSystemOperationContext* unused,
543 const FilePath& root_path) { 545 const FilePath& root_path) {
544 return new FileSystemFileEnumerator( 546 return new FileSystemFileEnumerator(
545 root_path, true, static_cast<file_util::FileEnumerator::FILE_TYPE>( 547 root_path, true, static_cast<file_util::FileEnumerator::FILE_TYPE>(
546 file_util::FileEnumerator::FILES | 548 file_util::FileEnumerator::FILES |
547 file_util::FileEnumerator::DIRECTORIES)); 549 file_util::FileEnumerator::DIRECTORIES));
548 } 550 }
549 551
550 } // namespace fileapi 552 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_directory_database.h ('k') | webkit/fileapi/file_system_origin_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698