| OLD | NEW |
| 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 WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class FileSystemOperationContext; | 27 class FileSystemOperationContext; |
| 28 | 28 |
| 29 // A file utility interface that provides basic file utility methods for | 29 // A file utility interface that provides basic file utility methods for |
| 30 // FileSystem API. | 30 // FileSystem API. |
| 31 // | 31 // |
| 32 // Layering structure of the FileSystemFileUtil was split out. | 32 // Layering structure of the FileSystemFileUtil was split out. |
| 33 // See http://crbug.com/128136 if you need it. | 33 // See http://crbug.com/128136 if you need it. |
| 34 class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { | 34 class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { |
| 35 public: | 35 public: |
| 36 // It will be implemented by each subclass such as FileSystemFileEnumerator. | 36 // It will be implemented by each subclass such as FileSystemFileEnumerator. |
| 37 class AbstractFileEnumerator { | 37 class WEBKIT_STORAGE_EXPORT AbstractFileEnumerator { |
| 38 public: | 38 public: |
| 39 virtual ~AbstractFileEnumerator() {} | 39 virtual ~AbstractFileEnumerator() {} |
| 40 | 40 |
| 41 // Returns an empty string if there are no more results. | 41 // Returns an empty string if there are no more results. |
| 42 virtual FilePath Next() = 0; | 42 virtual FilePath Next() = 0; |
| 43 | 43 |
| 44 virtual int64 Size() = 0; | 44 virtual int64 Size() = 0; |
| 45 virtual base::Time LastModifiedTime() = 0; | 45 virtual base::Time LastModifiedTime() = 0; |
| 46 virtual bool IsDirectory() = 0; | 46 virtual bool IsDirectory() = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // A policy flag for CreateSnapshotFile. | 49 // A policy flag for CreateSnapshotFile. |
| 50 enum SnapshotFilePolicy { | 50 enum SnapshotFilePolicy { |
| 51 kSnapshotFileUnknown, | 51 kSnapshotFileUnknown, |
| 52 | 52 |
| 53 // The implementation just uses the local file as the snapshot file. | 53 // The implementation just uses the local file as the snapshot file. |
| 54 // The FileAPI backend does nothing on the returned file. | 54 // The FileAPI backend does nothing on the returned file. |
| 55 kSnapshotFileLocal, | 55 kSnapshotFileLocal, |
| 56 | 56 |
| 57 // The implementation returns a temporary file as the snapshot file. | 57 // The implementation returns a temporary file as the snapshot file. |
| 58 // The FileAPI backend takes care of the lifetime of the returned file | 58 // The FileAPI backend takes care of the lifetime of the returned file |
| 59 // and will delete when the last reference of the file is dropped. | 59 // and will delete when the last reference of the file is dropped. |
| 60 kSnapshotFileTemporary, | 60 kSnapshotFileTemporary, |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 class EmptyFileEnumerator : public AbstractFileEnumerator { | 63 class WEBKIT_STORAGE_EXPORT EmptyFileEnumerator |
| 64 : public AbstractFileEnumerator { |
| 64 virtual FilePath Next() OVERRIDE; | 65 virtual FilePath Next() OVERRIDE; |
| 65 virtual int64 Size() OVERRIDE; | 66 virtual int64 Size() OVERRIDE; |
| 66 virtual base::Time LastModifiedTime() OVERRIDE; | 67 virtual base::Time LastModifiedTime() OVERRIDE; |
| 67 virtual bool IsDirectory() OVERRIDE; | 68 virtual bool IsDirectory() OVERRIDE; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 virtual ~FileSystemFileUtil() {} | 71 virtual ~FileSystemFileUtil() {} |
| 71 | 72 |
| 72 // Creates or opens a file with the given flags. | 73 // Creates or opens a file with the given flags. |
| 73 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create | 74 // If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 protected: | 202 protected: |
| 202 FileSystemFileUtil() {} | 203 FileSystemFileUtil() {} |
| 203 | 204 |
| 204 private: | 205 private: |
| 205 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); | 206 DISALLOW_COPY_AND_ASSIGN(FileSystemFileUtil); |
| 206 }; | 207 }; |
| 207 | 208 |
| 208 } // namespace fileapi | 209 } // namespace fileapi |
| 209 | 210 |
| 210 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ | 211 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_UTIL_H_ |
| OLD | NEW |