| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
| 6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ | 6 #define WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/file_util_proxy.h" | 13 #include "base/file_util_proxy.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/platform_file.h" | 16 #include "base/platform_file.h" |
| 17 #include "webkit/fileapi/file_system_file_util.h" | |
| 18 #include "webkit/fileapi/file_system_types.h" | 17 #include "webkit/fileapi/file_system_types.h" |
| 18 #include "webkit/fileapi/fileapi_file_util.h" |
| 19 #include "webkit/fileapi/overlay_file_util.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 struct PlatformFileInfo; | 22 struct PlatformFileInfo; |
| 22 class MessageLoopProxy; | 23 class MessageLoopProxy; |
| 23 class Time; | 24 class Time; |
| 24 } | 25 } |
| 25 | 26 |
| 26 class GURL; | 27 class GURL; |
| 27 | 28 |
| 28 namespace fileapi { | 29 namespace fileapi { |
| 29 | 30 |
| 30 using base::PlatformFile; | 31 using base::PlatformFile; |
| 31 using base::PlatformFileError; | 32 using base::PlatformFileError; |
| 32 | 33 |
| 33 class FileSystemOperationContext; | 34 class FileSystemOperationContext; |
| 34 | 35 |
| 35 // An instance of this class is created and owned by *MountPointProvider. | 36 // An instance of this class is created and owned by *MountPointProvider. |
| 36 class LocalFileSystemFileUtil : public FileSystemFileUtil { | 37 class LocalFileUtil : public OverlayFileUtil { |
| 37 public: | 38 public: |
| 38 // |underlying_file_util| is owned by the instance. It will be deleted by | 39 // |underlying_file_util| is owned by the instance. It will be deleted by |
| 39 // the owner instance. For example, it can be instanciated as follows: | 40 // the owner instance. For example, it can be instanciated as follows: |
| 40 // FileSystemFileUtil* file_system_file_util = | 41 // FileUtil* file_util = new LocalFileUtil(new NativeFileUtil()); |
| 41 // new LocalFileSystemFileUtil(new FileSystemFileUtil()); | 42 explicit LocalFileUtil(FileUtil* underlying_file_util); |
| 42 explicit LocalFileSystemFileUtil(FileSystemFileUtil* underlying_file_util); | 43 virtual ~LocalFileUtil(); |
| 43 virtual ~LocalFileSystemFileUtil(); | |
| 44 | 44 |
| 45 virtual PlatformFileError CreateOrOpen( | 45 virtual PlatformFileError CreateOrOpen( |
| 46 FileSystemOperationContext* context, | 46 FileSystemOperationContext* context, |
| 47 const FilePath& file_path, | 47 const FilePath& file_path, |
| 48 int file_flags, | 48 int file_flags, |
| 49 PlatformFile* file_handle, | 49 PlatformFile* file_handle, |
| 50 bool* created); | 50 bool* created); |
| 51 | 51 |
| 52 virtual PlatformFileError EnsureFileExists( | 52 virtual PlatformFileError EnsureFileExists( |
| 53 FileSystemOperationContext* context, | 53 FileSystemOperationContext* context, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 // Given the filesystem's root URL and a virtual path, produces a real, full | 125 // Given the filesystem's root URL and a virtual path, produces a real, full |
| 126 // local path. | 126 // local path. |
| 127 FilePath GetLocalPath( | 127 FilePath GetLocalPath( |
| 128 FileSystemOperationContext* context, | 128 FileSystemOperationContext* context, |
| 129 const GURL& origin_url, | 129 const GURL& origin_url, |
| 130 FileSystemType type, | 130 FileSystemType type, |
| 131 const FilePath& virtual_path); | 131 const FilePath& virtual_path); |
| 132 | 132 |
| 133 scoped_ptr<FileSystemFileUtil> underlying_file_util_; | 133 DISALLOW_COPY_AND_ASSIGN(LocalFileUtil); |
| 134 | |
| 135 DISALLOW_COPY_AND_ASSIGN(LocalFileSystemFileUtil); | |
| 136 }; | 134 }; |
| 137 | 135 |
| 138 } // namespace fileapi | 136 } // namespace fileapi |
| 139 | 137 |
| 140 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_FILE_UTIL_H_ | 138 #endif // WEBKIT_FILEAPI_LOCAL_FILE_UTIL_H_ |
| OLD | NEW |