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

Side by Side Diff: base/files/file_util_proxy.cc

Issue 18286004: Move PathExists 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
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/files/file_util_proxy_unittest.cc » ('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) 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 "base/files/file_util_proxy.h" 5 #include "base/files/file_util_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 PlatformFileError error_; 100 PlatformFileError error_;
101 DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper); 101 DISALLOW_COPY_AND_ASSIGN(CreateTemporaryHelper);
102 }; 102 };
103 103
104 class GetFileInfoHelper { 104 class GetFileInfoHelper {
105 public: 105 public:
106 GetFileInfoHelper() 106 GetFileInfoHelper()
107 : error_(PLATFORM_FILE_OK) {} 107 : error_(PLATFORM_FILE_OK) {}
108 108
109 void RunWorkForFilePath(const FilePath& file_path) { 109 void RunWorkForFilePath(const FilePath& file_path) {
110 if (!file_util::PathExists(file_path)) { 110 if (!PathExists(file_path)) {
111 error_ = PLATFORM_FILE_ERROR_NOT_FOUND; 111 error_ = PLATFORM_FILE_ERROR_NOT_FOUND;
112 return; 112 return;
113 } 113 }
114 if (!file_util::GetFileInfo(file_path, &file_info_)) 114 if (!file_util::GetFileInfo(file_path, &file_info_))
115 error_ = PLATFORM_FILE_ERROR_FAILED; 115 error_ = PLATFORM_FILE_ERROR_FAILED;
116 } 116 }
117 117
118 void RunWorkForPlatformFile(PlatformFile file) { 118 void RunWorkForPlatformFile(PlatformFile file) {
119 if (!GetPlatformFileInfo(file, &file_info_)) 119 if (!GetPlatformFileInfo(file, &file_info_))
120 error_ = PLATFORM_FILE_ERROR_FAILED; 120 error_ = PLATFORM_FILE_ERROR_FAILED;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 PlatformFileError CloseAdapter(PlatformFile file_handle) { 205 PlatformFileError CloseAdapter(PlatformFile file_handle) {
206 if (!ClosePlatformFile(file_handle)) { 206 if (!ClosePlatformFile(file_handle)) {
207 return PLATFORM_FILE_ERROR_FAILED; 207 return PLATFORM_FILE_ERROR_FAILED;
208 } 208 }
209 return PLATFORM_FILE_OK; 209 return PLATFORM_FILE_OK;
210 } 210 }
211 211
212 PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) { 212 PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) {
213 if (!file_util::PathExists(file_path)) { 213 if (!PathExists(file_path)) {
214 return PLATFORM_FILE_ERROR_NOT_FOUND; 214 return PLATFORM_FILE_ERROR_NOT_FOUND;
215 } 215 }
216 if (!base::Delete(file_path, recursive)) { 216 if (!base::Delete(file_path, recursive)) {
217 if (!recursive && !file_util::IsDirectoryEmpty(file_path)) { 217 if (!recursive && !file_util::IsDirectoryEmpty(file_path)) {
218 return PLATFORM_FILE_ERROR_NOT_EMPTY; 218 return PLATFORM_FILE_ERROR_NOT_EMPTY;
219 } 219 }
220 return PLATFORM_FILE_ERROR_FAILED; 220 return PLATFORM_FILE_ERROR_FAILED;
221 } 221 }
222 return PLATFORM_FILE_OK; 222 return PLATFORM_FILE_OK;
223 } 223 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 bool FileUtilProxy::RelayClose( 417 bool FileUtilProxy::RelayClose(
418 TaskRunner* task_runner, 418 TaskRunner* task_runner,
419 const CloseTask& close_task, 419 const CloseTask& close_task,
420 PlatformFile file_handle, 420 PlatformFile file_handle,
421 const StatusCallback& callback) { 421 const StatusCallback& callback) {
422 return base::PostTaskAndReplyWithResult( 422 return base::PostTaskAndReplyWithResult(
423 task_runner, FROM_HERE, Bind(close_task, file_handle), callback); 423 task_runner, FROM_HERE, Bind(close_task, file_handle), callback);
424 } 424 }
425 425
426 } // namespace base 426 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/files/file_util_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698