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
3 // found in the LICENSE file.
5 // IPC messages for the file system.
6 // Multiply-included message file, hence no include guard.
8 #include "ipc/ipc_message_macros.h"
9 #include "ipc/ipc_platform_file.h"
11 #include "webkit/common/fileapi/directory_entry.h"
12 #include "webkit/common/fileapi/file_system_info.h"
13 #include "webkit/common/fileapi/file_system_types.h"
14 #include "webkit/common/quota/quota_types.h"
16 #undef IPC_MESSAGE_EXPORT
17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
18 #define IPC_MESSAGE_START FileSystemMsgStart
20 IPC_STRUCT_TRAITS_BEGIN(fileapi::DirectoryEntry)
21 IPC_STRUCT_TRAITS_MEMBER(name)
22 IPC_STRUCT_TRAITS_MEMBER(is_directory)
23 IPC_STRUCT_TRAITS_END()
25 IPC_STRUCT_TRAITS_BEGIN(fileapi::FileSystemInfo)
26 IPC_STRUCT_TRAITS_MEMBER(name)
27 IPC_STRUCT_TRAITS_MEMBER(root_url)
28 IPC_STRUCT_TRAITS_MEMBER(mount_type)
29 IPC_STRUCT_TRAITS_END()
31 IPC_ENUM_TRAITS(fileapi::FileSystemType)
32 IPC_ENUM_TRAITS(quota::QuotaLimitType)
34 // File system messages sent from the browser to the child process.
36 // WebFrameClient::openFileSystem response messages.
37 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidOpenFileSystem,
39 std::string /* name */,
42 // WebFileSystem response messages.
43 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidResolveURL,
45 fileapi::FileSystemInfo /* filesystem_info */,
46 base::FilePath /* file_path */,
47 bool /* is_directory */)
48 IPC_MESSAGE_CONTROL1(FileSystemMsg_DidSucceed,
50 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata,
52 base::PlatformFileInfo)
53 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile,
55 base::PlatformFileInfo,
56 base::FilePath /* true platform path */)
57 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory,
59 std::vector<fileapi::DirectoryEntry> /* entries */,
61 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite,
63 int64 /* byte count */,
65 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidOpenFile,
67 IPC::PlatformFileForTransit,
68 int /* file_open_id */,
69 quota::QuotaLimitType /* quota_policy */)
70 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail,
72 base::PlatformFileError /* error_code */)
74 // File system messages sent from the child process to the browser.
76 // WebFrameClient::openFileSystem() message.
77 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenFileSystem,
79 GURL /* origin_url */,
80 fileapi::FileSystemType /* type */)
82 // WevFrameClient::resolveURL() message.
83 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ResolveURL,
85 GURL /* filesystem_url */)
87 // WebFrameClient::deleteFileSystem() message.
88 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_DeleteFileSystem,
90 GURL /* origin_url */,
91 fileapi::FileSystemType /* type */)
93 // WebFileSystem::move() message.
94 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Move,
99 // WebFileSystem::copy() message.
100 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Copy,
101 int /* request_id */,
103 GURL /* dest path */)
105 // WebFileSystem::remove() message.
106 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Remove,
107 int /* request_id */,
109 bool /* recursive */)
111 // WebFileSystem::readMetadata() message.
112 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadMetadata,
113 int /* request_id */,
116 // WebFileSystem::create() message.
117 IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Create,
118 int /* request_id */,
120 bool /* exclusive */,
121 bool /* is_directory */,
122 bool /* recursive */)
124 // WebFileSystem::exists() messages.
125 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Exists,
126 int /* request_id */,
128 bool /* is_directory */)
130 // WebFileSystem::readDirectory() message.
131 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadDirectory,
132 int /* request_id */,
135 // WebFileWriter::write() message.
136 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_WriteDeprecated,
137 int /* request id */,
138 GURL /* file path */,
140 int64 /* position */)
142 // WebFileWriter::write() message.
143 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_Write,
144 int /* request id */,
145 GURL /* file path */,
146 std::string /* blob uuid */,
147 int64 /* position */)
149 // WebFileWriter::truncate() message.
150 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Truncate,
151 int /* request id */,
152 GURL /* file path */,
155 // Pepper's Touch() message.
156 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile,
157 int /* request_id */,
159 base::Time /* last_access_time */,
160 base::Time /* last_modified_time */)
162 // WebFileWriter::cancel() message.
163 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite,
164 int /* request id */,
165 int /* id of request to cancel */)
167 // Pepper's OpenFile message.
168 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenPepperFile,
169 int /* request id */,
170 GURL /* file path */,
171 int /* pp_open_flags */)
173 // Pepper's NotifyCloseFile message.
174 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_NotifyCloseFile,
175 int /* file_open_id */)
177 // WebFileSystem::createSnapshotFileAndReadMetadata() message.
178 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CreateSnapshotFile,
179 int /* request_id */,
180 GURL /* file_path */)
182 // Renderers are expected to send this message after having processed
183 // the FileSystemMsg_DidCreateSnapshotFile message. In particular,
184 // after having created a BlobDataHandle backed by the snapshot file.
185 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_DidReceiveSnapshotFile,
186 int /* request_id */)
188 // For Pepper's URL loader.
189 IPC_SYNC_MESSAGE_CONTROL1_1(FileSystemHostMsg_SyncGetPlatformPath,
190 GURL /* file path */,
191 base::FilePath /* platform_path */)
193 // Pre- and post-update notifications for ppapi implementation.
194 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_WillUpdate,
195 GURL /* file_path */)
197 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_DidUpdate,
198 GURL /* file_path */,