| 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_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
| 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
| 7 | 7 |
| 8 #include "base/file_util_proxy.h" | 8 #include "base/file_util_proxy.h" |
| 9 #include "base/id_map.h" | 9 #include "base/id_map.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebFileSyste
m.h" |
| 13 #include "webkit/fileapi/file_system_context.h" | 13 #include "webkit/fileapi/file_system_context.h" |
| 14 #include "webkit/fileapi/file_system_operation_interface.h" | 14 #include "webkit/fileapi/file_system_operation_interface.h" |
| 15 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
| 16 #include <vector> | 16 #include <vector> |
| 17 | 17 |
| 18 namespace WebKit { | 18 namespace WebKit { |
| 19 class WebFileSystemCallbacks; | 19 class WebFileSystemCallbacks; |
| 20 class WebFrame; | 20 class WebFrame; |
| 21 class WebURL; | 21 class WebURL; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace fileapi { | 24 namespace fileapi { |
| 25 class FileSystemContext; | 25 class FileSystemContext; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace webkit_blob { |
| 29 class BlobStorageController; |
| 30 } |
| 31 |
| 28 class SimpleFileSystem | 32 class SimpleFileSystem |
| 29 : public WebKit::WebFileSystem, | 33 : public WebKit::WebFileSystem, |
| 30 public base::SupportsWeakPtr<SimpleFileSystem> { | 34 public base::SupportsWeakPtr<SimpleFileSystem> { |
| 31 public: | 35 public: |
| 32 SimpleFileSystem(); | 36 SimpleFileSystem(); |
| 33 virtual ~SimpleFileSystem(); | 37 virtual ~SimpleFileSystem(); |
| 34 | 38 |
| 35 void OpenFileSystem(WebKit::WebFrame* frame, | 39 void OpenFileSystem(WebKit::WebFrame* frame, |
| 36 WebKit::WebFileSystem::Type type, | 40 WebKit::WebFileSystem::Type type, |
| 37 long long size, | 41 long long size, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 virtual void readDirectory( | 81 virtual void readDirectory( |
| 78 const WebKit::WebURL& path, | 82 const WebKit::WebURL& path, |
| 79 WebKit::WebFileSystemCallbacks*) OVERRIDE; | 83 WebKit::WebFileSystemCallbacks*) OVERRIDE; |
| 80 virtual WebKit::WebFileWriter* createFileWriter( | 84 virtual WebKit::WebFileWriter* createFileWriter( |
| 81 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; | 85 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; |
| 82 virtual void createSnapshotFileAndReadMetadata( | 86 virtual void createSnapshotFileAndReadMetadata( |
| 83 const WebKit::WebURL& blobURL, | 87 const WebKit::WebURL& blobURL, |
| 84 const WebKit::WebURL& path, | 88 const WebKit::WebURL& path, |
| 85 WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE; | 89 WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE; |
| 86 | 90 |
| 91 static void InitializeOnIOThread( |
| 92 webkit_blob::BlobStorageController* blob_storage_controller); |
| 93 static void CleanupOnIOThread(); |
| 94 |
| 87 private: | 95 private: |
| 88 // Helpers. | 96 // Helpers. |
| 89 fileapi::FileSystemOperationInterface* GetNewOperation( | 97 fileapi::FileSystemOperationInterface* GetNewOperation( |
| 90 const WebKit::WebURL& path); | 98 const WebKit::WebURL& path); |
| 91 | 99 |
| 92 // Callback Handlers | 100 // Callback Handlers |
| 93 fileapi::FileSystemOperationInterface::StatusCallback FinishHandler( | 101 fileapi::FileSystemOperationInterface::StatusCallback FinishHandler( |
| 94 WebKit::WebFileSystemCallbacks* callbacks); | 102 WebKit::WebFileSystemCallbacks* callbacks); |
| 95 fileapi::FileSystemOperationInterface::GetMetadataCallback GetMetadataHandler( | 103 fileapi::FileSystemOperationInterface::GetMetadataCallback GetMetadataHandler( |
| 96 WebKit::WebFileSystemCallbacks* callbacks); | 104 WebKit::WebFileSystemCallbacks* callbacks); |
| 97 fileapi::FileSystemOperationInterface::ReadDirectoryCallback | 105 fileapi::FileSystemOperationInterface::ReadDirectoryCallback |
| 98 ReadDirectoryHandler(WebKit::WebFileSystemCallbacks* callbacks); | 106 ReadDirectoryHandler(WebKit::WebFileSystemCallbacks* callbacks); |
| 99 fileapi::FileSystemContext::OpenFileSystemCallback OpenFileSystemHandler( | 107 fileapi::FileSystemContext::OpenFileSystemCallback OpenFileSystemHandler( |
| 100 WebKit::WebFileSystemCallbacks* callbacks); | 108 WebKit::WebFileSystemCallbacks* callbacks); |
| 101 fileapi::FileSystemOperationInterface::SnapshotFileCallback | 109 fileapi::FileSystemOperationInterface::SnapshotFileCallback |
| 102 SnapshotFileHandler(WebKit::WebFileSystemCallbacks* callbacks); | 110 SnapshotFileHandler(const GURL& blob_url, |
| 111 WebKit::WebFileSystemCallbacks* callbacks); |
| 103 void DidFinish(WebKit::WebFileSystemCallbacks* callbacks, | 112 void DidFinish(WebKit::WebFileSystemCallbacks* callbacks, |
| 104 base::PlatformFileError result); | 113 base::PlatformFileError result); |
| 105 void DidGetMetadata(WebKit::WebFileSystemCallbacks* callbacks, | 114 void DidGetMetadata(WebKit::WebFileSystemCallbacks* callbacks, |
| 106 base::PlatformFileError result, | 115 base::PlatformFileError result, |
| 107 const base::PlatformFileInfo& info, | 116 const base::PlatformFileInfo& info, |
| 108 const FilePath& platform_path); | 117 const FilePath& platform_path); |
| 109 void DidReadDirectory( | 118 void DidReadDirectory( |
| 110 WebKit::WebFileSystemCallbacks* callbacks, | 119 WebKit::WebFileSystemCallbacks* callbacks, |
| 111 base::PlatformFileError result, | 120 base::PlatformFileError result, |
| 112 const std::vector<base::FileUtilProxy::Entry>& entries, | 121 const std::vector<base::FileUtilProxy::Entry>& entries, |
| 113 bool has_more); | 122 bool has_more); |
| 114 void DidOpenFileSystem(WebKit::WebFileSystemCallbacks* callbacks, | 123 void DidOpenFileSystem(WebKit::WebFileSystemCallbacks* callbacks, |
| 115 base::PlatformFileError result, | 124 base::PlatformFileError result, |
| 116 const std::string& name, const GURL& root); | 125 const std::string& name, const GURL& root); |
| 117 void DidCreateSnapshotFile( | 126 void DidCreateSnapshotFile( |
| 127 const GURL& blob_url, |
| 118 WebKit::WebFileSystemCallbacks* callbacks, | 128 WebKit::WebFileSystemCallbacks* callbacks, |
| 119 base::PlatformFileError result, | 129 base::PlatformFileError result, |
| 120 const base::PlatformFileInfo& info, | 130 const base::PlatformFileInfo& info, |
| 121 const FilePath& platform_path, | 131 const FilePath& platform_path, |
| 122 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); | 132 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); |
| 123 | 133 |
| 124 // A temporary directory for FileSystem API. | 134 // A temporary directory for FileSystem API. |
| 125 ScopedTempDir file_system_dir_; | 135 ScopedTempDir file_system_dir_; |
| 126 | 136 |
| 127 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 137 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 128 | 138 |
| 129 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); | 139 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); |
| 130 }; | 140 }; |
| 131 | 141 |
| 132 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 142 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
| OLD | NEW |