OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 // Multiply-included message file, so no include guard. |
| 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "chrome/common/extensions/update_manifest.h" |
| 13 #include "chrome/common/media_galleries/iphoto_library.h" |
| 14 #include "chrome/common/media_galleries/itunes_library.h" |
| 15 #include "chrome/common/media_galleries/metadata_types.h" |
| 16 #include "chrome/common/media_galleries/picasa_types.h" |
| 17 #include "ipc/ipc_message_macros.h" |
| 18 #include "ipc/ipc_platform_file.h" |
| 19 |
| 20 #if !defined(ENABLE_EXTENSIONS) |
| 21 #error "Extensions must be enabled" |
| 22 #endif |
| 23 |
| 24 #define IPC_MESSAGE_START ChromeUtilityExtensionsMsgStart |
| 25 |
| 26 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result) |
| 27 IPC_STRUCT_TRAITS_MEMBER(extension_id) |
| 28 IPC_STRUCT_TRAITS_MEMBER(version) |
| 29 IPC_STRUCT_TRAITS_MEMBER(browser_min_version) |
| 30 IPC_STRUCT_TRAITS_MEMBER(package_hash) |
| 31 IPC_STRUCT_TRAITS_MEMBER(crx_url) |
| 32 IPC_STRUCT_TRAITS_END() |
| 33 |
| 34 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results) |
| 35 IPC_STRUCT_TRAITS_MEMBER(list) |
| 36 IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds) |
| 37 IPC_STRUCT_TRAITS_END() |
| 38 |
| 39 #if defined(OS_MACOSX) |
| 40 IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Photo) |
| 41 IPC_STRUCT_TRAITS_MEMBER(id) |
| 42 IPC_STRUCT_TRAITS_MEMBER(location) |
| 43 IPC_STRUCT_TRAITS_MEMBER(original_location) |
| 44 IPC_STRUCT_TRAITS_END() |
| 45 |
| 46 IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Library) |
| 47 IPC_STRUCT_TRAITS_MEMBER(albums) |
| 48 IPC_STRUCT_TRAITS_MEMBER(all_photos) |
| 49 IPC_STRUCT_TRAITS_END() |
| 50 #endif // defined(OS_MACOSX) |
| 51 |
| 52 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 53 IPC_STRUCT_TRAITS_BEGIN(itunes::parser::Track) |
| 54 IPC_STRUCT_TRAITS_MEMBER(id) |
| 55 IPC_STRUCT_TRAITS_MEMBER(location) |
| 56 IPC_STRUCT_TRAITS_END() |
| 57 |
| 58 IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumInfo) |
| 59 IPC_STRUCT_TRAITS_MEMBER(name) |
| 60 IPC_STRUCT_TRAITS_MEMBER(timestamp) |
| 61 IPC_STRUCT_TRAITS_MEMBER(uid) |
| 62 IPC_STRUCT_TRAITS_MEMBER(path) |
| 63 IPC_STRUCT_TRAITS_END() |
| 64 |
| 65 // These files are opened read-only. Please see the constructor for |
| 66 // picasa::AlbumTableFiles for details. |
| 67 IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumTableFilesForTransit) |
| 68 IPC_STRUCT_TRAITS_MEMBER(indicator_file) |
| 69 IPC_STRUCT_TRAITS_MEMBER(category_file) |
| 70 IPC_STRUCT_TRAITS_MEMBER(date_file) |
| 71 IPC_STRUCT_TRAITS_MEMBER(filename_file) |
| 72 IPC_STRUCT_TRAITS_MEMBER(name_file) |
| 73 IPC_STRUCT_TRAITS_MEMBER(token_file) |
| 74 IPC_STRUCT_TRAITS_MEMBER(uid_file) |
| 75 IPC_STRUCT_TRAITS_END() |
| 76 |
| 77 IPC_STRUCT_TRAITS_BEGIN(picasa::FolderINIContents) |
| 78 IPC_STRUCT_TRAITS_MEMBER(folder_path) |
| 79 IPC_STRUCT_TRAITS_MEMBER(ini_contents) |
| 80 IPC_STRUCT_TRAITS_END() |
| 81 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 82 |
| 83 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 84 IPC_STRUCT_TRAITS_BEGIN(metadata::AttachedImage) |
| 85 IPC_STRUCT_TRAITS_MEMBER(type) |
| 86 IPC_STRUCT_TRAITS_MEMBER(data) |
| 87 IPC_STRUCT_TRAITS_END() |
| 88 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 89 |
| 90 //------------------------------------------------------------------------------ |
| 91 // Utility process messages: |
| 92 // These are messages from the browser to the utility process. |
| 93 |
| 94 // Tells the utility process to unpack the given extension file in its |
| 95 // directory and verify that it is valid. |
| 96 IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_UnpackExtension, |
| 97 base::FilePath /* extension_filename */, |
| 98 std::string /* extension_id */, |
| 99 int /* Manifest::Location */, |
| 100 int /* InitFromValue flags */) |
| 101 |
| 102 // Tell the utility process to parse the given xml document. |
| 103 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseUpdateManifest, |
| 104 std::string /* xml document contents */) |
| 105 |
| 106 // Tell the utility process to decode the given image data, which is base64 |
| 107 // encoded. |
| 108 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImageBase64, |
| 109 std::string) // base64 encoded image contents |
| 110 |
| 111 // Tell the utility process to parse a JSON string into a Value object. |
| 112 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseJSON, |
| 113 std::string /* JSON to parse */) |
| 114 |
| 115 #if defined(OS_WIN) |
| 116 // Tell the utility process to parse the iTunes preference XML file contents |
| 117 // and return the path to the iTunes directory. |
| 118 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesPrefXml, |
| 119 std::string /* XML to parse */) |
| 120 #endif // defined(OS_WIN) |
| 121 |
| 122 #if defined(OS_MACOSX) |
| 123 // Tell the utility process to parse the iPhoto library XML file and |
| 124 // return the parse result as well as the iPhoto library as an iphoto::Library. |
| 125 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseIPhotoLibraryXmlFile, |
| 126 IPC::PlatformFileForTransit /* XML file to parse */) |
| 127 #endif // defined(OS_MACOSX) |
| 128 |
| 129 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 130 // Tell the utility process to parse the iTunes library XML file and |
| 131 // return the parse result as well as the iTunes library as an itunes::Library. |
| 132 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesLibraryXmlFile, |
| 133 IPC::PlatformFileForTransit /* XML file to parse */) |
| 134 |
| 135 // Tells the utility process to parse the Picasa PMP database and return a |
| 136 // listing of the user's Picasa albums and folders, along with metadata. |
| 137 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParsePicasaPMPDatabase, |
| 138 picasa::AlbumTableFilesForTransit /* album_table_files */) |
| 139 |
| 140 // Tells the utility process to index the Picasa user-created Album contents |
| 141 // by parsing all the INI files in Picasa Folders. |
| 142 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents, |
| 143 picasa::AlbumUIDSet /* album_uids */, |
| 144 std::vector<picasa::FolderINIContents> /* folders_inis */) |
| 145 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 146 |
| 147 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 148 // Tell the utility process to attempt to validate the passed media file. The |
| 149 // file will undergo basic sanity checks and will be decoded for up to |
| 150 // |milliseconds_of_decoding| wall clock time. It is still not safe to decode |
| 151 // the file in the browser process after this check. |
| 152 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_CheckMediaFile, |
| 153 int64 /* milliseconds_of_decoding */, |
| 154 IPC::PlatformFileForTransit /* Media file to parse */) |
| 155 |
| 156 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata, |
| 157 std::string /* mime_type */, |
| 158 int64 /* total_size */, |
| 159 bool /* get_attached_images */) |
| 160 |
| 161 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished, |
| 162 int64 /* request_id */, |
| 163 std::string /* bytes */) |
| 164 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 165 |
| 166 // Requests that the utility process write the contents of the source file to |
| 167 // the removable drive listed in the target file. The target will be restricted |
| 168 // to removable drives by the utility process. |
| 169 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Write, |
| 170 base::FilePath /* source file */, |
| 171 base::FilePath /* target file */) |
| 172 |
| 173 // Requests that the utility process verify that the contents of the source file |
| 174 // was written to the target. As above the target will be restricted to |
| 175 // removable drives by the utility process. |
| 176 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Verify, |
| 177 base::FilePath /* source file */, |
| 178 base::FilePath /* target file */) |
| 179 |
| 180 // Cancels a pending write or verify operation. |
| 181 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_ImageWriter_Cancel) |
| 182 |
| 183 //------------------------------------------------------------------------------ |
| 184 // Utility process host messages: |
| 185 // These are messages from the utility process to the browser. |
| 186 |
| 187 // Reply when the utility process is done unpacking an extension. |manifest| |
| 188 // is the parsed manifest.json file. |
| 189 // The unpacker should also have written out files containing the decoded |
| 190 // images and message catalogs from the extension. The data is written into a |
| 191 // DecodedImages struct into a file named kDecodedImagesFilename in the |
| 192 // directory that was passed in. This is done because the data is too large to |
| 193 // pass over IPC. |
| 194 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Succeeded, |
| 195 base::DictionaryValue /* manifest */) |
| 196 |
| 197 // Reply when the utility process has failed while unpacking an extension. |
| 198 // |error_message| is a user-displayable explanation of what went wrong. |
| 199 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Failed, |
| 200 base::string16 /* error_message, if any */) |
| 201 |
| 202 // Reply when the utility process has succeeded in parsing an update manifest |
| 203 // xml document. |
| 204 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded, |
| 205 UpdateManifest::Results /* updates */) |
| 206 |
| 207 // Reply when an error occurred parsing the update manifest. |error_message| |
| 208 // is a description of what went wrong suitable for logging. |
| 209 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Failed, |
| 210 std::string /* error_message, if any */) |
| 211 |
| 212 // Reply when the utility process successfully parsed a JSON string. |
| 213 // |
| 214 // WARNING: The result can be of any Value subclass type, but we can't easily |
| 215 // pass indeterminate value types by const object reference with our IPC macros, |
| 216 // so we put the result Value into a ListValue. Handlers should examine the |
| 217 // first (and only) element of the ListValue for the actual result. |
| 218 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Succeeded, |
| 219 base::ListValue) |
| 220 |
| 221 // Reply when the utility process failed in parsing a JSON string. |
| 222 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Failed, |
| 223 std::string /* error message, if any*/) |
| 224 |
| 225 #if defined(OS_WIN) |
| 226 // Reply after parsing the iTunes preferences XML file contents with either the |
| 227 // path to the iTunes directory or an empty FilePath. |
| 228 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GotITunesDirectory, |
| 229 base::FilePath /* Path to iTunes library */) |
| 230 #endif // defined(OS_WIN) |
| 231 |
| 232 #if defined(OS_MACOSX) |
| 233 // Reply after parsing the iPhoto library XML file with the parser result and |
| 234 // an iphoto::Library data structure. |
| 235 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotIPhotoLibrary, |
| 236 bool /* Parser result */, |
| 237 iphoto::parser::Library /* iPhoto library */) |
| 238 #endif // defined(OS_MACOSX) |
| 239 |
| 240 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 241 // Reply after parsing the iTunes library XML file with the parser result and |
| 242 // an itunes::Library data structure. |
| 243 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotITunesLibrary, |
| 244 bool /* Parser result */, |
| 245 itunes::parser::Library /* iTunes library */) |
| 246 |
| 247 // Reply after parsing the Picasa PMP Database with the parser result and a |
| 248 // listing of the user's Picasa albums and folders, along with metadata. |
| 249 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished, |
| 250 bool /* parse_success */, |
| 251 std::vector<picasa::AlbumInfo> /* albums */, |
| 252 std::vector<picasa::AlbumInfo> /* folders */) |
| 253 |
| 254 // Reply after indexing the Picasa user-created Album contents by parsing all |
| 255 // the INI files in Picasa Folders. |
| 256 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished, |
| 257 picasa::AlbumImagesMap /* albums_images */) |
| 258 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
| 259 |
| 260 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 261 // Reply after checking the passed media file. A true result indicates that |
| 262 // the file appears to be a well formed media file. |
| 263 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished, |
| 264 bool /* passed_checks */) |
| 265 |
| 266 IPC_MESSAGE_CONTROL3( |
| 267 ChromeUtilityHostMsg_ParseMediaMetadata_Finished, |
| 268 bool /* parse_success */, |
| 269 base::DictionaryValue /* metadata */, |
| 270 std::vector<metadata::AttachedImage> /* attached_images */) |
| 271 |
| 272 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes, |
| 273 int64 /* request_id */, |
| 274 int64 /* start_byte */, |
| 275 int64 /* length */) |
| 276 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 277 |
| 278 // Reply when a write or verify operation succeeds. |
| 279 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded) |
| 280 |
| 281 // Reply when a write or verify operation has been fully cancelled. |
| 282 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Cancelled) |
| 283 |
| 284 // Reply when a write or verify operation fails to complete. |
| 285 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Failed, |
| 286 std::string /* message */) |
| 287 |
| 288 // Periodic status update about the progress of an operation. |
| 289 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Progress, |
| 290 int64 /* number of bytes processed */) |
| 291 |
| 292 #if defined(OS_WIN) |
| 293 // Get plain-text WiFi credentials from the system (requires UAC privilege |
| 294 // elevation) and encrypt them with |public_key|. |
| 295 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials, |
| 296 std::string /* ssid */, |
| 297 std::vector<uint8> /* public_key */) |
| 298 |
| 299 // Reply after getting WiFi credentials from the system and encrypting them with |
| 300 // caller's public key. |success| is false if error occurred. |
| 301 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotEncryptedWiFiCredentials, |
| 302 std::vector<uint8> /* encrypted_key_data */, |
| 303 bool /* success */) |
| 304 #endif // defined(OS_WIN) |
OLD | NEW |