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_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/WebFileSystem.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" |
13 #include "webkit/fileapi/file_system_types.h" | 13 #include "webkit/fileapi/file_system_types.h" |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 namespace WebKit { | 16 namespace WebKit { |
17 class WebFileSystemCallbacks; | 17 class WebFileSystemCallbacks; |
18 class WebFrame; | 18 class WebFrame; |
| 19 class WebURL; |
19 } | 20 } |
20 | 21 |
21 namespace fileapi { | 22 namespace fileapi { |
22 class FileSystemContext; | 23 class FileSystemContext; |
23 class FileSystemOperation; | 24 class FileSystemOperation; |
24 } | 25 } |
25 | 26 |
26 class SimpleFileSystem | 27 class SimpleFileSystem |
27 : public WebKit::WebFileSystem, | 28 : public WebKit::WebFileSystem, |
28 public base::SupportsWeakPtr<SimpleFileSystem> { | 29 public base::SupportsWeakPtr<SimpleFileSystem> { |
29 public: | 30 public: |
30 SimpleFileSystem(); | 31 SimpleFileSystem(); |
31 virtual ~SimpleFileSystem(); | 32 virtual ~SimpleFileSystem(); |
32 | 33 |
33 void OpenFileSystem(WebKit::WebFrame* frame, | 34 void OpenFileSystem(WebKit::WebFrame* frame, |
34 WebKit::WebFileSystem::Type type, | 35 WebKit::WebFileSystem::Type type, |
35 long long size, | 36 long long size, |
36 bool create, | 37 bool create, |
37 WebKit::WebFileSystemCallbacks* callbacks); | 38 WebKit::WebFileSystemCallbacks* callbacks); |
38 | 39 |
39 fileapi::FileSystemContext* file_system_context() { | 40 fileapi::FileSystemContext* file_system_context() { |
40 return file_system_context_.get(); | 41 return file_system_context_.get(); |
41 } | 42 } |
42 | 43 |
43 // WebKit::WebFileSystem methods. | 44 // New WebKit::WebFileSystem overrides. |
| 45 virtual void move( |
| 46 const WebKit::WebURL& src_path, |
| 47 const WebKit::WebURL& dest_path, |
| 48 WebKit::WebFileSystemCallbacks*); |
| 49 |
| 50 virtual void copy( |
| 51 const WebKit::WebURL& src_path, |
| 52 const WebKit::WebURL& dest_path, |
| 53 WebKit::WebFileSystemCallbacks*); |
| 54 |
| 55 virtual void remove( |
| 56 const WebKit::WebURL& path, |
| 57 WebKit::WebFileSystemCallbacks*); |
| 58 |
| 59 virtual void removeRecursively( |
| 60 const WebKit::WebURL& path, |
| 61 WebKit::WebFileSystemCallbacks*); |
| 62 |
| 63 virtual void readMetadata( |
| 64 const WebKit::WebURL& path, |
| 65 WebKit::WebFileSystemCallbacks*); |
| 66 |
| 67 virtual void createFile( |
| 68 const WebKit::WebURL& path, |
| 69 bool exclusive, |
| 70 WebKit::WebFileSystemCallbacks*); |
| 71 |
| 72 virtual void createDirectory( |
| 73 const WebKit::WebURL& path, |
| 74 bool exclusive, |
| 75 WebKit::WebFileSystemCallbacks*); |
| 76 |
| 77 virtual void fileExists( |
| 78 const WebKit::WebURL& path, |
| 79 WebKit::WebFileSystemCallbacks*); |
| 80 |
| 81 virtual void directoryExists( |
| 82 const WebKit::WebURL& path, |
| 83 WebKit::WebFileSystemCallbacks*); |
| 84 |
| 85 virtual void readDirectory( |
| 86 const WebKit::WebURL& path, |
| 87 WebKit::WebFileSystemCallbacks*); |
| 88 |
| 89 virtual WebKit::WebFileWriter* createFileWriter( |
| 90 const WebKit::WebURL& path, WebKit::WebFileWriterClient*); |
| 91 |
| 92 // Old WebKit::WebFileSystem overrides, soon to go away. |
44 virtual void move(const WebKit::WebString& src_path, | 93 virtual void move(const WebKit::WebString& src_path, |
45 const WebKit::WebString& dest_path, | 94 const WebKit::WebString& dest_path, |
46 WebKit::WebFileSystemCallbacks* callbacks); | 95 WebKit::WebFileSystemCallbacks* callbacks); |
47 virtual void copy(const WebKit::WebString& src_path, | 96 virtual void copy(const WebKit::WebString& src_path, |
48 const WebKit::WebString& dest_path, | 97 const WebKit::WebString& dest_path, |
49 WebKit::WebFileSystemCallbacks* callbacks); | 98 WebKit::WebFileSystemCallbacks* callbacks); |
50 virtual void remove(const WebKit::WebString& path, | 99 virtual void remove(const WebKit::WebString& path, |
51 WebKit::WebFileSystemCallbacks* callbacks); | 100 WebKit::WebFileSystemCallbacks* callbacks); |
52 virtual void removeRecursively(const WebKit::WebString& path, | 101 virtual void removeRecursively(const WebKit::WebString& path, |
53 WebKit::WebFileSystemCallbacks* callbacks); | 102 WebKit::WebFileSystemCallbacks* callbacks); |
(...skipping 21 matching lines...) Expand all Loading... |
75 | 124 |
76 // A temporary directory for FileSystem API. | 125 // A temporary directory for FileSystem API. |
77 ScopedTempDir file_system_dir_; | 126 ScopedTempDir file_system_dir_; |
78 | 127 |
79 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 128 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
80 | 129 |
81 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); | 130 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); |
82 }; | 131 }; |
83 | 132 |
84 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 133 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
OLD | NEW |