1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_
#define WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_
#include <vector>
#include "base/file_util_proxy.h"
#include "base/id_map.h"
#include "base/memory/scoped_temp_dir.h"
#include "base/memory/weak_ptr.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h"
#include "webkit/fileapi/file_system_types.h"
namespace WebKit {
class WebFileSystemCallbacks;
class WebFrame;
}
namespace fileapi {
class FileSystemContext;
class FileSystemOperation;
}
class SimpleFileSystem
: public WebKit::WebFileSystem,
public base::SupportsWeakPtr<SimpleFileSystem> {
public:
SimpleFileSystem();
virtual ~SimpleFileSystem();
void OpenFileSystem(WebKit::WebFrame* frame,
WebKit::WebFileSystem::Type type,
long long size,
bool create,
WebKit::WebFileSystemCallbacks* callbacks);
fileapi::FileSystemContext* file_system_context() {
return file_system_context_.get();
}
// WebKit::WebFileSystem methods.
virtual void move(const WebKit::WebString& src_path,
const WebKit::WebString& dest_path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void copy(const WebKit::WebString& src_path,
const WebKit::WebString& dest_path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void remove(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void removeRecursively(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void readMetadata(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void createFile(const WebKit::WebString& path,
bool exclusive,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void createDirectory(const WebKit::WebString& path,
bool exclusive,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void fileExists(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void directoryExists(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual void readDirectory(const WebKit::WebString& path,
WebKit::WebFileSystemCallbacks* callbacks);
virtual WebKit::WebFileWriter* createFileWriter(
const WebKit::WebString& path, WebKit::WebFileWriterClient* client);
private:
// Helpers.
fileapi::FileSystemOperation* GetNewOperation(
WebKit::WebFileSystemCallbacks* callbacks);
// A temporary directory for FileSystem API.
ScopedTempDir file_system_dir_;
scoped_refptr<fileapi::FileSystemContext> file_system_context_;
DISALLOW_COPY_AND_ASSIGN(SimpleFileSystem);
};
#endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_FILE_SYSTEM_H_
|