| 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" | |
| 14 #include "webkit/fileapi/file_system_operation_interface.h" | |
| 15 #include "webkit/fileapi/file_system_types.h" | 13 #include "webkit/fileapi/file_system_types.h" |
| 16 #include <vector> | 14 #include <vector> |
| 17 | 15 |
| 18 namespace WebKit { | 16 namespace WebKit { |
| 19 class WebFileSystemCallbacks; | 17 class WebFileSystemCallbacks; |
| 20 class WebFrame; | 18 class WebFrame; |
| 21 class WebURL; | 19 class WebURL; |
| 22 } | 20 } |
| 23 | 21 |
| 24 namespace fileapi { | 22 namespace fileapi { |
| 25 class FileSystemContext; | 23 class FileSystemContext; |
| 24 class FileSystemOperationInterface; |
| 26 } | 25 } |
| 27 | 26 |
| 28 class SimpleFileSystem | 27 class SimpleFileSystem |
| 29 : public WebKit::WebFileSystem, | 28 : public WebKit::WebFileSystem, |
| 30 public base::SupportsWeakPtr<SimpleFileSystem> { | 29 public base::SupportsWeakPtr<SimpleFileSystem> { |
| 31 public: | 30 public: |
| 32 SimpleFileSystem(); | 31 SimpleFileSystem(); |
| 33 virtual ~SimpleFileSystem(); | 32 virtual ~SimpleFileSystem(); |
| 34 | 33 |
| 35 void OpenFileSystem(WebKit::WebFrame* frame, | 34 void OpenFileSystem(WebKit::WebFrame* frame, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 WebKit::WebFileSystemCallbacks*) OVERRIDE; | 75 WebKit::WebFileSystemCallbacks*) OVERRIDE; |
| 77 virtual void readDirectory( | 76 virtual void readDirectory( |
| 78 const WebKit::WebURL& path, | 77 const WebKit::WebURL& path, |
| 79 WebKit::WebFileSystemCallbacks*) OVERRIDE; | 78 WebKit::WebFileSystemCallbacks*) OVERRIDE; |
| 80 virtual WebKit::WebFileWriter* createFileWriter( | 79 virtual WebKit::WebFileWriter* createFileWriter( |
| 81 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; | 80 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; |
| 82 | 81 |
| 83 private: | 82 private: |
| 84 // Helpers. | 83 // Helpers. |
| 85 fileapi::FileSystemOperationInterface* GetNewOperation( | 84 fileapi::FileSystemOperationInterface* GetNewOperation( |
| 86 const WebKit::WebURL& path); | 85 const WebKit::WebURL& path, WebKit::WebFileSystemCallbacks* callbacks); |
| 87 | |
| 88 // Callback Handlers | |
| 89 fileapi::FileSystemOperationInterface::StatusCallback FinishHandler( | |
| 90 WebKit::WebFileSystemCallbacks* callbacks); | |
| 91 fileapi::FileSystemOperationInterface::GetMetadataCallback GetMetadataHandler( | |
| 92 WebKit::WebFileSystemCallbacks* callbacks); | |
| 93 fileapi::FileSystemOperationInterface::ReadDirectoryCallback | |
| 94 ReadDirectoryHandler(WebKit::WebFileSystemCallbacks* callbacks); | |
| 95 fileapi::FileSystemContext::OpenFileSystemCallback OpenFileSystemHandler( | |
| 96 WebKit::WebFileSystemCallbacks* callbacks); | |
| 97 void DidFinish(WebKit::WebFileSystemCallbacks* callbacks, | |
| 98 base::PlatformFileError result); | |
| 99 void DidGetMetadata(WebKit::WebFileSystemCallbacks* callbacks, | |
| 100 base::PlatformFileError result, | |
| 101 const base::PlatformFileInfo& info, | |
| 102 const FilePath& platform_path); | |
| 103 void DidReadDirectory( | |
| 104 WebKit::WebFileSystemCallbacks* callbacks, | |
| 105 base::PlatformFileError result, | |
| 106 const std::vector<base::FileUtilProxy::Entry>& entries, | |
| 107 bool has_more); | |
| 108 void DidOpenFileSystem(WebKit::WebFileSystemCallbacks* callbacks, | |
| 109 base::PlatformFileError result, | |
| 110 const std::string& name, const GURL& root); | |
| 111 | 86 |
| 112 // A temporary directory for FileSystem API. | 87 // A temporary directory for FileSystem API. |
| 113 ScopedTempDir file_system_dir_; | 88 ScopedTempDir file_system_dir_; |
| 114 | 89 |
| 115 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 90 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
| 116 | 91 |
| 117 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); | 92 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); |
| 118 }; | 93 }; |
| 119 | 94 |
| 120 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ | 95 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ |
| OLD | NEW |