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

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

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | « no previous file | base/files/file_util_proxy.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 #ifndef BASE_FILES_FILE_UTIL_PROXY_H_ 5 #ifndef BASE_FILES_FILE_UTIL_PROXY_H_
6 #define BASE_FILES_FILE_UTIL_PROXY_H_ 6 #define BASE_FILES_FILE_UTIL_PROXY_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "base/files/file.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/platform_file.h" 13 #include "base/platform_file.h"
13 14
14 namespace tracked_objects { 15 namespace tracked_objects {
15 class Location; 16 class Location;
16 }; 17 };
17 18
18 namespace base { 19 namespace base {
19 20
20 class TaskRunner; 21 class TaskRunner;
21 class Time; 22 class Time;
22 23
23 // This class provides asynchronous access to common file routines. 24 // This class provides asynchronous access to common file routines.
24 class BASE_EXPORT FileUtilProxy { 25 class BASE_EXPORT FileUtilProxy {
25 public: 26 public:
26 // This callback is used by methods that report only an error code. It is 27 // This callback is used by methods that report only an error code. It is
27 // valid to pass a null callback to any function that takes a StatusCallback, 28 // valid to pass a null callback to any function that takes a StatusCallback,
28 // in which case the operation will complete silently. 29 // in which case the operation will complete silently.
29 typedef Callback<void(PlatformFileError)> StatusCallback; 30 typedef Callback<void(File::Error)> StatusCallback;
30 31
31 typedef Callback<void(PlatformFileError, 32 typedef Callback<void(File::Error,
32 PassPlatformFile, 33 PassPlatformFile,
33 bool /* created */)> CreateOrOpenCallback; 34 bool /* created */)> CreateOrOpenCallback;
34 typedef Callback<void(PlatformFileError, 35 typedef Callback<void(File::Error,
35 PassPlatformFile, 36 PassPlatformFile,
36 const FilePath&)> CreateTemporaryCallback; 37 const FilePath&)> CreateTemporaryCallback;
37 typedef Callback<void(PlatformFileError, 38 typedef Callback<void(File::Error,
38 const PlatformFileInfo&)> GetFileInfoCallback; 39 const File::Info&)> GetFileInfoCallback;
39 typedef Callback<void(PlatformFileError, 40 typedef Callback<void(File::Error,
40 const char* /* data */, 41 const char* /* data */,
41 int /* bytes read */)> ReadCallback; 42 int /* bytes read */)> ReadCallback;
42 typedef Callback<void(PlatformFileError, 43 typedef Callback<void(File::Error,
43 int /* bytes written */)> WriteCallback; 44 int /* bytes written */)> WriteCallback;
44 45
45 typedef Callback<PlatformFileError(PlatformFile*, bool*)> CreateOrOpenTask; 46 typedef Callback<File::Error(PlatformFile*, bool*)> CreateOrOpenTask;
46 typedef Callback<PlatformFileError(PlatformFile)> CloseTask; 47 typedef Callback<File::Error(PlatformFile)> CloseTask;
47 typedef Callback<PlatformFileError(void)> FileTask; 48 typedef Callback<File::Error(void)> FileTask;
48 49
49 // Creates or opens a file with the given flags. It is invalid to pass a null 50 // Creates or opens a file with the given flags. It is invalid to pass a null
50 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to 51 // callback. If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to
51 // create a new file at the given |file_path| and calls back with 52 // create a new file at the given |file_path| and calls back with
52 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists. 53 // PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
53 // 54 //
54 // This returns false if task posting to |task_runner| has failed. 55 // This returns false if task posting to |task_runner| has failed.
55 static bool CreateOrOpen(TaskRunner* task_runner, 56 static bool CreateOrOpen(TaskRunner* task_runner,
56 const FilePath& file_path, 57 const FilePath& file_path,
57 int file_flags, 58 int file_flags,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 PlatformFile, 187 PlatformFile,
187 const StatusCallback& callback); 188 const StatusCallback& callback);
188 189
189 private: 190 private:
190 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy); 191 DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
191 }; 192 };
192 193
193 } // namespace base 194 } // namespace base
194 195
195 #endif // BASE_FILES_FILE_UTIL_PROXY_H_ 196 #endif // BASE_FILES_FILE_UTIL_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file_util_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698