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. 4 5 // IPC messages for the file system. 6 // Multiply-included message file, hence no include guard. 7 8 #include "ipc/ipc_message_macros.h" 9 #include "ipc/ipc_platform_file.h" 10 #include "url/gurl.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" 15 16 #undef IPC_MESSAGE_EXPORT 17 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 18 #define IPC_MESSAGE_START FileSystemMsgStart 19 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() 24 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() 30 31 IPC_ENUM_TRAITS(fileapi::FileSystemType) 32 IPC_ENUM_TRAITS(quota::QuotaLimitType) 33 34 // File system messages sent from the browser to the child process. 35 36 // WebFrameClient::openFileSystem response messages. 37 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidOpenFileSystem, 38 int /* request_id */, 39 std::string /* name */, 40 GURL /* root_url */) 41 42 // WebFileSystem response messages. 43 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidResolveURL, 44 int /* request_id */, 45 fileapi::FileSystemInfo /* filesystem_info */, 46 base::FilePath /* file_path */, 47 bool /* is_directory */) 48 IPC_MESSAGE_CONTROL1(FileSystemMsg_DidSucceed, 49 int /* request_id */) 50 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata, 51 int /* request_id */, 52 base::PlatformFileInfo) 53 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidCreateSnapshotFile, 54 int /* request_id */, 55 base::PlatformFileInfo, 56 base::FilePath /* true platform path */) 57 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory, 58 int /* request_id */, 59 std::vector<fileapi::DirectoryEntry> /* entries */, 60 bool /* has_more */) 61 IPC_MESSAGE_CONTROL3(FileSystemMsg_DidWrite, 62 int /* request_id */, 63 int64 /* byte count */, 64 bool /* complete */) 65 IPC_MESSAGE_CONTROL4(FileSystemMsg_DidOpenFile, 66 int /* request_id */, 67 IPC::PlatformFileForTransit, 68 int /* file_open_id */, 69 quota::QuotaLimitType /* quota_policy */) 70 IPC_MESSAGE_CONTROL2(FileSystemMsg_DidFail, 71 int /* request_id */, 72 base::PlatformFileError /* error_code */) 73 74 // File system messages sent from the child process to the browser. 75 76 // WebFrameClient::openFileSystem() message. 77 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_OpenFileSystem, 78 int /* request_id */, 79 GURL /* origin_url */, 80 fileapi::FileSystemType /* type */) 81 82 // WevFrameClient::resolveURL() message. 83 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ResolveURL, 84 int /* request_id */, 85 GURL /* filesystem_url */) 86 87 // WebFrameClient::deleteFileSystem() message. 88 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_DeleteFileSystem, 89 int /* request_id */, 90 GURL /* origin_url */, 91 fileapi::FileSystemType /* type */) 92 93 // WebFileSystem::move() message. 94 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Move, 95 int /* request_id */, 96 GURL /* src path */, 97 GURL /* dest path */) 98 99 // WebFileSystem::copy() message. 100 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Copy, 101 int /* request_id */, 102 GURL /* src path */, 103 GURL /* dest path */) 104 105 // WebFileSystem::remove() message. 106 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Remove, 107 int /* request_id */, 108 GURL /* path */, 109 bool /* recursive */) 110 111 // WebFileSystem::readMetadata() message. 112 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadMetadata, 113 int /* request_id */, 114 GURL /* path */) 115 116 // WebFileSystem::create() message. 117 IPC_MESSAGE_CONTROL5(FileSystemHostMsg_Create, 118 int /* request_id */, 119 GURL /* path */, 120 bool /* exclusive */, 121 bool /* is_directory */, 122 bool /* recursive */) 123 124 // WebFileSystem::exists() messages. 125 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Exists, 126 int /* request_id */, 127 GURL /* path */, 128 bool /* is_directory */) 129 130 // WebFileSystem::readDirectory() message. 131 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_ReadDirectory, 132 int /* request_id */, 133 GURL /* path */) 134 135 // WebFileWriter::write() message. 136 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_WriteDeprecated, 137 int /* request id */, 138 GURL /* file path */, 139 GURL /* blob URL */, 140 int64 /* position */) 141 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 */) 148 149 // WebFileWriter::truncate() message. 150 IPC_MESSAGE_CONTROL3(FileSystemHostMsg_Truncate, 151 int /* request id */, 152 GURL /* file path */, 153 int64 /* length */) 154 155 // Pepper's Touch() message. 156 IPC_MESSAGE_CONTROL4(FileSystemHostMsg_TouchFile, 157 int /* request_id */, 158 GURL /* path */, 159 base::Time /* last_access_time */, 160 base::Time /* last_modified_time */) 161 162 // WebFileWriter::cancel() message. 163 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CancelWrite, 164 int /* request id */, 165 int /* id of request to cancel */) 166 167 // WebFileSystem::createSnapshotFileAndReadMetadata() message. 168 IPC_MESSAGE_CONTROL2(FileSystemHostMsg_CreateSnapshotFile, 169 int /* request_id */, 170 GURL /* file_path */) 171 172 // Renderers are expected to send this message after having processed 173 // the FileSystemMsg_DidCreateSnapshotFile message. In particular, 174 // after having created a BlobDataHandle backed by the snapshot file. 175 IPC_MESSAGE_CONTROL1(FileSystemHostMsg_DidReceiveSnapshotFile, 176 int /* request_id */) 177 178 // For Pepper's URL loader. 179 IPC_SYNC_MESSAGE_CONTROL1_1(FileSystemHostMsg_SyncGetPlatformPath, 180 GURL /* file path */, 181 base::FilePath /* platform_path */) 182