| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 8 #include <vector> |
| 9 #include "base/file_util_proxy.h" | 9 #include "base/file_util_proxy.h" |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/scoped_temp_dir.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" |
| 12 #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" | 13 #include "webkit/fileapi/file_system_types.h" |
| 13 #include "webkit/fileapi/file_system_operation.h" | 14 |
| 15 namespace WebKit { |
| 16 class WebFileSystemCallbacks; |
| 17 class WebFrame; |
| 18 } |
| 19 |
| 20 namespace fileapi { |
| 21 class SandboxedFileSystemContext; |
| 22 class SandboxedFileSystemOperation; |
| 23 } |
| 14 | 24 |
| 15 class SimpleFileSystem : public WebKit::WebFileSystem { | 25 class SimpleFileSystem : public WebKit::WebFileSystem { |
| 16 public: | 26 public: |
| 17 SimpleFileSystem() {} | 27 SimpleFileSystem(); |
| 18 virtual ~SimpleFileSystem(); | 28 virtual ~SimpleFileSystem(); |
| 19 | 29 |
| 20 void RemoveCompletedOperation(int request_id); | 30 void OpenFileSystem(WebKit::WebFrame* frame, |
| 31 WebKit::WebFileSystem::Type type, |
| 32 long long size, |
| 33 bool create, |
| 34 WebKit::WebFileSystemCallbacks* callbacks); |
| 21 | 35 |
| 22 // WebKit::WebFileSystem methods. | 36 // WebKit::WebFileSystem methods. |
| 23 virtual void move(const WebKit::WebString& src_path, | 37 virtual void move(const WebKit::WebString& src_path, |
| 24 const WebKit::WebString& dest_path, | 38 const WebKit::WebString& dest_path, |
| 25 WebKit::WebFileSystemCallbacks* callbacks); | 39 WebKit::WebFileSystemCallbacks* callbacks); |
| 26 virtual void copy(const WebKit::WebString& src_path, | 40 virtual void copy(const WebKit::WebString& src_path, |
| 27 const WebKit::WebString& dest_path, | 41 const WebKit::WebString& dest_path, |
| 28 WebKit::WebFileSystemCallbacks* callbacks); | 42 WebKit::WebFileSystemCallbacks* callbacks); |
| 29 virtual void remove(const WebKit::WebString& path, | 43 virtual void remove(const WebKit::WebString& path, |
| 30 WebKit::WebFileSystemCallbacks* callbacks); | 44 WebKit::WebFileSystemCallbacks* callbacks); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 WebKit::WebFileSystemCallbacks* callbacks); | 56 WebKit::WebFileSystemCallbacks* callbacks); |
| 43 virtual void directoryExists(const WebKit::WebString& path, | 57 virtual void directoryExists(const WebKit::WebString& path, |
| 44 WebKit::WebFileSystemCallbacks* callbacks); | 58 WebKit::WebFileSystemCallbacks* callbacks); |
| 45 virtual void readDirectory(const WebKit::WebString& path, | 59 virtual void readDirectory(const WebKit::WebString& path, |
| 46 WebKit::WebFileSystemCallbacks* callbacks); | 60 WebKit::WebFileSystemCallbacks* callbacks); |
| 47 virtual WebKit::WebFileWriter* createFileWriter( | 61 virtual WebKit::WebFileWriter* createFileWriter( |
| 48 const WebKit::WebString& path, WebKit::WebFileWriterClient* client); | 62 const WebKit::WebString& path, WebKit::WebFileWriterClient* client); |
| 49 | 63 |
| 50 private: | 64 private: |
| 51 // Helpers. | 65 // Helpers. |
| 52 fileapi::FileSystemOperation* GetNewOperation( | 66 fileapi::SandboxedFileSystemOperation* GetNewOperation( |
| 53 WebKit::WebFileSystemCallbacks* callbacks); | 67 WebKit::WebFileSystemCallbacks* callbacks); |
| 54 | 68 |
| 55 // Keeps ongoing file system operations. | 69 // A temporary directory for FileSystem API. |
| 56 typedef IDMap<fileapi::FileSystemOperation, IDMapOwnPointer> OperationsMap; | 70 ScopedTempDir file_system_dir_; |
| 57 OperationsMap operations_; | 71 |
| 72 scoped_ptr<fileapi::SandboxedFileSystemContext> sandboxed_context_; |
| 58 | 73 |
| 59 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); | 74 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); |
| 60 }; | 75 }; |
| 61 | 76 |
| 62 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 77 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
| OLD | NEW |