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

Unified Diff: base/file_util_proxy.h

Issue 3743004: Rename FileUtilProxy::Create to EnsureFileExists (Closed)
Patch Set: fixed comments Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_proxy.h
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index 11fc988b74ce7cfffa79dd8add756b573ad51cce..09c23778a09bb49c8f49d8173d8800548398c72b 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -40,6 +40,9 @@ class FileUtilProxy {
// Creates or opens a file with the given flags. It is invalid to pass NULL
// for the callback.
+ // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create
+ // a new file at the given |file_path| and calls back with
+ // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
typedef Callback3<base::PlatformFileError /* error code */,
base::PassPlatformFile,
bool /* created */>::Type CreateOrOpenCallback;
@@ -48,13 +51,6 @@ class FileUtilProxy {
int file_flags,
CreateOrOpenCallback* callback);
- // Creates a file with the given flags. This one is a variation of
- // CreateOrOpen but it doesn't return a file handle.
- static bool Create(scoped_refptr<MessageLoopProxy> message_loop_proxy,
- const FilePath& file_path,
- int file_flags,
- CreateOrOpenCallback* callback);
-
// Creates a temporary file for writing. The path and an open file handle
// are returned. It is invalid to pass NULL for the callback.
typedef Callback3<base::PlatformFileError /* error code */,
@@ -69,6 +65,22 @@ class FileUtilProxy {
base::PlatformFile,
StatusCallback* callback);
+ // Ensures that the given |file_path| exist. This creates a empty new file
+ // at |file_path| if the |file_path| does not exist.
+ // If a new file han not existed and is created at the |file_path|,
+ // |created| of the callback argument is set true and |error code|
+ // is set PLATFORM_FILE_OK.
+ // If the file already exists, |created| is set false and |error code|
+ // is set PLATFORM_FILE_OK.
+ // If the file hasn't existed but it couldn't be created for some other
+ // reasons, |created| is set false and |error code| indicates the error.
+ typedef Callback2<base::PlatformFileError /* error code */,
+ bool /* created */>::Type EnsureFileExistsCallback;
+ static bool EnsureFileExists(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ const FilePath& file_path,
+ EnsureFileExistsCallback* callback);
+
// Retrieves the information about a file. It is invalid to pass NULL for the
// callback.
typedef Callback2<base::PlatformFileError /* error code */,
« no previous file with comments | « no previous file | base/file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698