| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Multiply-included message file, so no include guard. | 5 // Multiply-included message file, so no include guard. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <tuple> | |
| 9 | 8 |
| 10 #include "extensions/common/update_manifest.h" | 9 #include "extensions/common/update_manifest.h" |
| 11 #include "ipc/ipc_message_macros.h" | 10 #include "ipc/ipc_message_macros.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | |
| 13 #include "ui/gfx/ipc/skia/gfx_skia_param_traits.h" | |
| 14 #include "url/ipc/url_param_traits.h" | 11 #include "url/ipc/url_param_traits.h" |
| 15 | 12 |
| 16 #define IPC_MESSAGE_START ExtensionUtilityMsgStart | 13 #define IPC_MESSAGE_START ExtensionUtilityMsgStart |
| 17 | 14 |
| 18 #ifndef EXTENSIONS_COMMON_EXTENSION_UTILITY_MESSAGES_H_ | |
| 19 #define EXTENSIONS_COMMON_EXTENSION_UTILITY_MESSAGES_H_ | |
| 20 | |
| 21 using DecodedImages = std::vector<std::tuple<SkBitmap, base::FilePath>>; | |
| 22 | |
| 23 #endif // EXTENSIONS_COMMON_EXTENSION_UTILITY_MESSAGES_H_ | |
| 24 | |
| 25 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result) | 15 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result) |
| 26 IPC_STRUCT_TRAITS_MEMBER(extension_id) | 16 IPC_STRUCT_TRAITS_MEMBER(extension_id) |
| 27 IPC_STRUCT_TRAITS_MEMBER(version) | 17 IPC_STRUCT_TRAITS_MEMBER(version) |
| 28 IPC_STRUCT_TRAITS_MEMBER(browser_min_version) | 18 IPC_STRUCT_TRAITS_MEMBER(browser_min_version) |
| 29 IPC_STRUCT_TRAITS_MEMBER(package_hash) | 19 IPC_STRUCT_TRAITS_MEMBER(package_hash) |
| 30 IPC_STRUCT_TRAITS_MEMBER(crx_url) | 20 IPC_STRUCT_TRAITS_MEMBER(crx_url) |
| 31 IPC_STRUCT_TRAITS_END() | 21 IPC_STRUCT_TRAITS_END() |
| 32 | 22 |
| 33 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results) | 23 IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results) |
| 34 IPC_STRUCT_TRAITS_MEMBER(list) | 24 IPC_STRUCT_TRAITS_MEMBER(list) |
| 35 IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds) | 25 IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds) |
| 36 IPC_STRUCT_TRAITS_END() | 26 IPC_STRUCT_TRAITS_END() |
| 37 | 27 |
| 38 //------------------------------------------------------------------------------ | 28 //------------------------------------------------------------------------------ |
| 39 // Utility process messages: | 29 // Utility process messages: |
| 40 // These are messages from the browser to the utility process. | 30 // These are messages from the browser to the utility process. |
| 41 | 31 |
| 42 // Tell the utility process to parse the given xml document. | 32 // Tell the utility process to parse the given xml document. |
| 43 IPC_MESSAGE_CONTROL1(ExtensionUtilityMsg_ParseUpdateManifest, | 33 IPC_MESSAGE_CONTROL1(ExtensionUtilityMsg_ParseUpdateManifest, |
| 44 std::string /* xml document contents */) | 34 std::string /* xml document contents */) |
| 45 | 35 |
| 46 // Tell the utility process to unzip the zipfile at a given path into a | |
| 47 // directory at the second given path. | |
| 48 IPC_MESSAGE_CONTROL2(ExtensionUtilityMsg_UnzipToDir, | |
| 49 base::FilePath /* zip_file */, | |
| 50 base::FilePath /* dir */) | |
| 51 | |
| 52 // Tells the utility process to validate and sanitize the extension in a | |
| 53 // directory. | |
| 54 IPC_MESSAGE_CONTROL4(ExtensionUtilityMsg_UnpackExtension, | |
| 55 base::FilePath /* directory_path */, | |
| 56 std::string /* extension_id */, | |
| 57 int /* Manifest::Location */, | |
| 58 int /* InitFromValue flags */) | |
| 59 | |
| 60 //------------------------------------------------------------------------------ | 36 //------------------------------------------------------------------------------ |
| 61 // Utility process host messages: | 37 // Utility process host messages: |
| 62 // These are messages from the utility process to the browser. | 38 // These are messages from the utility process to the browser. |
| 63 | 39 |
| 64 // Reply when the utility process has succeeded in parsing an update manifest | 40 // Reply when the utility process has succeeded in parsing an update manifest |
| 65 // xml document. | 41 // xml document. |
| 66 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded, | 42 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded, |
| 67 UpdateManifest::Results /* updates */) | 43 UpdateManifest::Results /* updates */) |
| 68 | 44 |
| 69 // Reply when an error occurred parsing the update manifest. |error_message| | 45 // Reply when an error occurred parsing the update manifest. |error_message| |
| 70 // is a description of what went wrong suitable for logging. | 46 // is a description of what went wrong suitable for logging. |
| 71 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_ParseUpdateManifest_Failed, | 47 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_ParseUpdateManifest_Failed, |
| 72 std::string /* error_message, if any */) | 48 std::string /* error_message, if any */) |
| 73 | |
| 74 // Reply when the utility process is done unzipping a file. |unpacked_path| | |
| 75 // is the directory which contains the unzipped contents. | |
| 76 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_UnzipToDir_Succeeded, | |
| 77 base::FilePath /* unpacked_path */) | |
| 78 | |
| 79 // Reply when the utility process failed to unzip a file. |error| contains | |
| 80 // an error string to be reported to the user. | |
| 81 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_UnzipToDir_Failed, | |
| 82 std::string /* error */) | |
| 83 | |
| 84 // Reply when the utility process is done unpacking an extension. |manifest| | |
| 85 // is the parsed manifest.json file. | |
| 86 // The unpacker should also have written out files containing the decoded | |
| 87 // images and message catalogs from the extension. The data is written into a | |
| 88 // DecodedImages struct into a file named kDecodedImagesFilename in the | |
| 89 // directory that was passed in. This is done because the data is too large to | |
| 90 // pass over IPC. | |
| 91 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_UnpackExtension_Succeeded, | |
| 92 base::DictionaryValue /* manifest */) | |
| 93 | |
| 94 // Reply when the utility process has failed while unpacking an extension. | |
| 95 // |error_message| is a user-displayable explanation of what went wrong. | |
| 96 IPC_MESSAGE_CONTROL1(ExtensionUtilityHostMsg_UnpackExtension_Failed, | |
| 97 base::string16 /* error_message, if any */) | |
| OLD | NEW |