OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/files/file.h" |
12 #include "base/files/file_util_proxy.h" | 13 #include "base/files/file_util_proxy.h" |
13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
15 #include "webkit/browser/fileapi/file_system_operation.h" | 16 #include "webkit/browser/fileapi/file_system_operation.h" |
16 #include "webkit/browser/webkit_storage_browser_export.h" | 17 #include "webkit/browser/webkit_storage_browser_export.h" |
17 #include "webkit/common/fileapi/directory_entry.h" | 18 #include "webkit/common/fileapi/directory_entry.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class Time; | 21 class Time; |
21 } | 22 } |
(...skipping 18 matching lines...) Expand all Loading... |
40 // (which is owned by FileSystemContext), it's guaranteed that this instance's | 41 // (which is owned by FileSystemContext), it's guaranteed that this instance's |
41 // alive while FileSystemOperationContext given to each operation is kept | 42 // alive while FileSystemOperationContext given to each operation is kept |
42 // alive. (Note that this instance might be freed on different thread | 43 // alive. (Note that this instance might be freed on different thread |
43 // from the thread it is created.) | 44 // from the thread it is created.) |
44 // | 45 // |
45 // It is NOT valid to give null callback to this class, and implementors | 46 // It is NOT valid to give null callback to this class, and implementors |
46 // can assume that they don't get any null callbacks. | 47 // can assume that they don't get any null callbacks. |
47 // | 48 // |
48 class AsyncFileUtil { | 49 class AsyncFileUtil { |
49 public: | 50 public: |
50 typedef base::Callback< | 51 typedef base::Callback<void(base::File::Error result)> StatusCallback; |
51 void(base::PlatformFileError result)> StatusCallback; | |
52 | 52 |
53 // |on_close_callback| will be called after the |file| is closed in the | 53 // |on_close_callback| will be called after the |file| is closed in the |
54 // child process. |on_close_callback|.is_null() can be true, if no operation | 54 // child process. |on_close_callback|.is_null() can be true, if no operation |
55 // is needed on closing the file. | 55 // is needed on closing the file. |
56 typedef base::Callback< | 56 typedef base::Callback< |
57 void(base::PlatformFileError result, | 57 void(base::File::Error result, |
58 base::PassPlatformFile file, | 58 base::PassPlatformFile file, |
59 const base::Closure& on_close_callback)> CreateOrOpenCallback; | 59 const base::Closure& on_close_callback)> CreateOrOpenCallback; |
60 | 60 |
61 typedef base::Callback< | 61 typedef base::Callback< |
62 void(base::PlatformFileError result, | 62 void(base::File::Error result, |
63 bool created)> EnsureFileExistsCallback; | 63 bool created)> EnsureFileExistsCallback; |
64 | 64 |
65 typedef base::Callback< | 65 typedef base::Callback< |
66 void(base::PlatformFileError result, | 66 void(base::File::Error result, |
67 const base::PlatformFileInfo& file_info)> GetFileInfoCallback; | 67 const base::File::Info& file_info)> GetFileInfoCallback; |
68 | 68 |
69 typedef std::vector<DirectoryEntry> EntryList; | 69 typedef std::vector<DirectoryEntry> EntryList; |
70 typedef base::Callback< | 70 typedef base::Callback< |
71 void(base::PlatformFileError result, | 71 void(base::File::Error result, |
72 const EntryList& file_list, | 72 const EntryList& file_list, |
73 bool has_more)> ReadDirectoryCallback; | 73 bool has_more)> ReadDirectoryCallback; |
74 | 74 |
75 typedef base::Callback< | 75 typedef base::Callback< |
76 void(base::PlatformFileError result, | 76 void(base::File::Error result, |
77 const base::PlatformFileInfo& file_info, | 77 const base::File::Info& file_info, |
78 const base::FilePath& platform_path, | 78 const base::FilePath& platform_path, |
79 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> | 79 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> |
80 CreateSnapshotFileCallback; | 80 CreateSnapshotFileCallback; |
81 | 81 |
82 | 82 |
83 typedef base::Callback<void(int64 size)> CopyFileProgressCallback; | 83 typedef base::Callback<void(int64 size)> CopyFileProgressCallback; |
84 | 84 |
85 typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption; | 85 typedef FileSystemOperation::CopyOrMoveOption CopyOrMoveOption; |
86 | 86 |
87 // Creates an AsyncFileUtil instance which performs file operations on | 87 // Creates an AsyncFileUtil instance which performs file operations on |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 const FileSystemURL& url, | 360 const FileSystemURL& url, |
361 const CreateSnapshotFileCallback& callback) = 0; | 361 const CreateSnapshotFileCallback& callback) = 0; |
362 | 362 |
363 private: | 363 private: |
364 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); | 364 DISALLOW_COPY_AND_ASSIGN(AsyncFileUtil); |
365 }; | 365 }; |
366 | 366 |
367 } // namespace fileapi | 367 } // namespace fileapi |
368 | 368 |
369 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ | 369 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_UTIL_H_ |
OLD | NEW |