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