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

Side by Side Diff: webkit/browser/fileapi/native_file_util.cc

Issue 18383003: Move DeleteAfterReboot and Move to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/fileapi/native_file_util.h" 5 #include "webkit/browser/fileapi/native_file_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_enumerator.h" 8 #include "base/files/file_enumerator.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "webkit/browser/fileapi/file_system_operation_context.h" 10 #include "webkit/browser/fileapi/file_system_operation_context.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (error != base::PLATFORM_FILE_OK) 224 if (error != base::PLATFORM_FILE_OK)
225 return error; 225 return error;
226 if (!info.is_directory) 226 if (!info.is_directory)
227 return base::PLATFORM_FILE_ERROR_NOT_FOUND; 227 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
228 } 228 }
229 229
230 if (copy) { 230 if (copy) {
231 if (file_util::CopyFile(src_path, dest_path)) 231 if (file_util::CopyFile(src_path, dest_path))
232 return base::PLATFORM_FILE_OK; 232 return base::PLATFORM_FILE_OK;
233 } else { 233 } else {
234 if (file_util::Move(src_path, dest_path)) 234 if (base::Move(src_path, dest_path))
235 return base::PLATFORM_FILE_OK; 235 return base::PLATFORM_FILE_OK;
236 } 236 }
237 return base::PLATFORM_FILE_ERROR_FAILED; 237 return base::PLATFORM_FILE_ERROR_FAILED;
238 } 238 }
239 239
240 PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { 240 PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) {
241 if (!file_util::PathExists(path)) 241 if (!file_util::PathExists(path))
242 return base::PLATFORM_FILE_ERROR_NOT_FOUND; 242 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
243 if (file_util::DirectoryExists(path)) 243 if (file_util::DirectoryExists(path))
244 return base::PLATFORM_FILE_ERROR_NOT_A_FILE; 244 return base::PLATFORM_FILE_ERROR_NOT_A_FILE;
245 if (!base::Delete(path, false)) 245 if (!base::Delete(path, false))
246 return base::PLATFORM_FILE_ERROR_FAILED; 246 return base::PLATFORM_FILE_ERROR_FAILED;
247 return base::PLATFORM_FILE_OK; 247 return base::PLATFORM_FILE_OK;
248 } 248 }
249 249
250 PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) { 250 PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) {
251 if (!file_util::PathExists(path)) 251 if (!file_util::PathExists(path))
252 return base::PLATFORM_FILE_ERROR_NOT_FOUND; 252 return base::PLATFORM_FILE_ERROR_NOT_FOUND;
253 if (!file_util::DirectoryExists(path)) 253 if (!file_util::DirectoryExists(path))
254 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; 254 return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY;
255 if (!file_util::IsDirectoryEmpty(path)) 255 if (!file_util::IsDirectoryEmpty(path))
256 return base::PLATFORM_FILE_ERROR_NOT_EMPTY; 256 return base::PLATFORM_FILE_ERROR_NOT_EMPTY;
257 if (!base::Delete(path, false)) 257 if (!base::Delete(path, false))
258 return base::PLATFORM_FILE_ERROR_FAILED; 258 return base::PLATFORM_FILE_ERROR_FAILED;
259 return base::PLATFORM_FILE_OK; 259 return base::PLATFORM_FILE_OK;
260 } 260 }
261 261
262 } // namespace fileapi 262 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/browser/database/database_tracker.cc ('k') | webkit/browser/fileapi/sandbox_isolated_origin_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698