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