Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(623)

Side by Side Diff: webkit/tools/test_shell/simple_file_system.h

Issue 9372044: Refactor FileSystemOperation to take callback for each method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reflected kinuko's comments + Fixture for failing-Write -> Cancel pattern. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
13 #include "webkit/fileapi/file_system_types.h" 15 #include "webkit/fileapi/file_system_types.h"
14 #include <vector> 16 #include <vector>
15 17
16 namespace WebKit { 18 namespace WebKit {
17 class WebFileSystemCallbacks; 19 class WebFileSystemCallbacks;
18 class WebFrame; 20 class WebFrame;
19 class WebURL; 21 class WebURL;
20 } 22 }
21 23
22 namespace fileapi { 24 namespace fileapi {
23 class FileSystemContext; 25 class FileSystemContext;
24 class FileSystemOperationInterface;
25 } 26 }
26 27
27 class SimpleFileSystem 28 class SimpleFileSystem
28 : public WebKit::WebFileSystem, 29 : public WebKit::WebFileSystem,
29 public base::SupportsWeakPtr<SimpleFileSystem> { 30 public base::SupportsWeakPtr<SimpleFileSystem> {
30 public: 31 public:
31 SimpleFileSystem(); 32 SimpleFileSystem();
32 virtual ~SimpleFileSystem(); 33 virtual ~SimpleFileSystem();
33 34
34 void OpenFileSystem(WebKit::WebFrame* frame, 35 void OpenFileSystem(WebKit::WebFrame* frame,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 WebKit::WebFileSystemCallbacks*) OVERRIDE; 76 WebKit::WebFileSystemCallbacks*) OVERRIDE;
76 virtual void readDirectory( 77 virtual void readDirectory(
77 const WebKit::WebURL& path, 78 const WebKit::WebURL& path,
78 WebKit::WebFileSystemCallbacks*) OVERRIDE; 79 WebKit::WebFileSystemCallbacks*) OVERRIDE;
79 virtual WebKit::WebFileWriter* createFileWriter( 80 virtual WebKit::WebFileWriter* createFileWriter(
80 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; 81 const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE;
81 82
82 private: 83 private:
83 // Helpers. 84 // Helpers.
84 fileapi::FileSystemOperationInterface* GetNewOperation( 85 fileapi::FileSystemOperationInterface* GetNewOperation(
85 const WebKit::WebURL& path, WebKit::WebFileSystemCallbacks* callbacks); 86 const WebKit::WebURL& path);
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);
86 111
87 // A temporary directory for FileSystem API. 112 // A temporary directory for FileSystem API.
88 ScopedTempDir file_system_dir_; 113 ScopedTempDir file_system_dir_;
89 114
90 scoped_refptr<fileapi::FileSystemContext> file_system_context_; 115 scoped_refptr<fileapi::FileSystemContext> file_system_context_;
91 116
92 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem); 117 DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem);
93 }; 118 };
94 119
95 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_ 120 #endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.cc ('k') | webkit/tools/test_shell/simple_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698