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
,
53 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile
,
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::File::Error
/* 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_Write
,
137 int /* request id */,
138 GURL
/* file path */,
139 std::string
/* blob uuid */,
140 int64
/* position */)
142 // WebFileWriter::truncate() message.
143 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Truncate
,
144 int /* request id */,
145 GURL
/* file path */,
148 // Pepper's Touch() message.
149 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile
,
150 int /* request_id */,
152 base::Time
/* last_access_time */,
153 base::Time
/* last_modified_time */)
155 // WebFileWriter::cancel() message.
156 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite
,
157 int /* request id */,
158 int /* id of request to cancel */)
160 // WebFileSystem::createSnapshotFileAndReadMetadata() message.
161 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CreateSnapshotFile
,
162 int /* request_id */,
163 GURL
/* file_path */)
165 // Renderers are expected to send this message after having processed
166 // the FileSystemMsg_DidCreateSnapshotFile message. In particular,
167 // after having created a BlobDataHandle backed by the snapshot file.
168 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_DidReceiveSnapshotFile
,
169 int /* request_id */)
171 // For Pepper's URL loader.
172 IPC_SYNC_MESSAGE_CONTROL1_1(FileSystemHostMsg_SyncGetPlatformPath
,
173 GURL
/* file path */,
174 base::FilePath
/* platform_path */)