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