blob: e67cec348cc3284f24d757ab9aa153fce61efa7d [file] [log] [blame]
[email protected]1a30dd32012-01-28 00:56:431// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]60f14392009-12-15 20:46:322// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]026d452a2011-03-04 18:12:345// Multiply-included message file, so no include guard.
[email protected]60f14392009-12-15 20:46:326
7#include <string>
[email protected]026d452a2011-03-04 18:12:348#include <vector>
[email protected]60f14392009-12-15 20:46:329
10#include "base/basictypes.h"
[email protected]026d452a2011-03-04 18:12:3411#include "base/file_path.h"
12#include "base/platform_file.h"
13#include "base/values.h"
[email protected]fc38935a2011-10-31 23:53:2814#include "chrome/common/extensions/extension.h"
[email protected]60f14392009-12-15 20:46:3215#include "chrome/common/extensions/update_manifest.h"
[email protected]19a5c7442011-10-21 20:00:4116#include "content/public/common/common_param_traits.h"
[email protected]cb4c5fbce2011-10-21 21:37:4717#include "content/public/common/serialized_script_value.h"
[email protected]026d452a2011-03-04 18:12:3418#include "ipc/ipc_message_macros.h"
[email protected]026d452a2011-03-04 18:12:3419#include "printing/backend/print_backend.h"
20#include "printing/page_range.h"
[email protected]da00dc12011-10-06 21:39:2621#include "printing/pdf_render_settings.h"
[email protected]026d452a2011-03-04 18:12:3422#include "third_party/skia/include/core/SkBitmap.h"
23#include "ui/gfx/rect.h"
[email protected]60f14392009-12-15 20:46:3224
[email protected]373c1062011-06-09 21:11:5125#define IPC_MESSAGE_START ChromeUtilityMsgStart
[email protected]026d452a2011-03-04 18:12:3426
[email protected]fffaf972011-03-24 01:34:3527IPC_STRUCT_TRAITS_BEGIN(printing::PageRange)
28 IPC_STRUCT_TRAITS_MEMBER(from)
29 IPC_STRUCT_TRAITS_MEMBER(to)
30IPC_STRUCT_TRAITS_END()
[email protected]e503a122011-03-17 18:20:5231
[email protected]fffaf972011-03-24 01:34:3532IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults)
33 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities)
34 IPC_STRUCT_TRAITS_MEMBER(caps_mime_type)
35 IPC_STRUCT_TRAITS_MEMBER(printer_defaults)
36 IPC_STRUCT_TRAITS_MEMBER(defaults_mime_type)
37IPC_STRUCT_TRAITS_END()
[email protected]60f14392009-12-15 20:46:3238
[email protected]026d452a2011-03-04 18:12:3439IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Result)
40 IPC_STRUCT_TRAITS_MEMBER(extension_id)
41 IPC_STRUCT_TRAITS_MEMBER(version)
42 IPC_STRUCT_TRAITS_MEMBER(browser_min_version)
43 IPC_STRUCT_TRAITS_MEMBER(package_hash)
44 IPC_STRUCT_TRAITS_MEMBER(crx_url)
45IPC_STRUCT_TRAITS_END()
[email protected]60f14392009-12-15 20:46:3246
[email protected]026d452a2011-03-04 18:12:3447IPC_STRUCT_TRAITS_BEGIN(UpdateManifest::Results)
48 IPC_STRUCT_TRAITS_MEMBER(list)
49 IPC_STRUCT_TRAITS_MEMBER(daystart_elapsed_seconds)
50IPC_STRUCT_TRAITS_END()
[email protected]5ef47ec2010-01-28 05:58:0551
[email protected]026d452a2011-03-04 18:12:3452//------------------------------------------------------------------------------
53// Utility process messages:
54// These are messages from the browser to the utility process.
55// Tell the utility process to unpack the given extension file in its
56// directory and verify that it is valid.
[email protected]f5bf1842012-02-15 02:52:2657IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_UnpackExtension,
[email protected]fc38935a2011-10-31 23:53:2858 FilePath /* extension_filename */,
[email protected]f5bf1842012-02-15 02:52:2659 std::string /* extension_id */,
[email protected]fc38935a2011-10-31 23:53:2860 int /* Extension::Location */,
61 int /* InitFromValue flags */)
[email protected]60f14392009-12-15 20:46:3262
[email protected]026d452a2011-03-04 18:12:3463// Tell the utility process to parse the given JSON data and verify its
64// validity.
[email protected]2ccf45c2011-08-19 23:35:5065IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_UnpackWebResource,
[email protected]026d452a2011-03-04 18:12:3466 std::string /* JSON data */)
[email protected]60f14392009-12-15 20:46:3267
[email protected]026d452a2011-03-04 18:12:3468// Tell the utility process to parse the given xml document.
[email protected]2ccf45c2011-08-19 23:35:5069IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseUpdateManifest,
[email protected]026d452a2011-03-04 18:12:3470 std::string /* xml document contents */)
71
72// Tell the utility process to decode the given image data.
[email protected]2ccf45c2011-08-19 23:35:5073IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImage,
[email protected]026d452a2011-03-04 18:12:3474 std::vector<unsigned char>) // encoded image contents
75
[email protected]5349ac6d2011-04-05 22:20:1776// Tell the utility process to decode the given image data, which is base64
77// encoded.
[email protected]2ccf45c2011-08-19 23:35:5078IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImageBase64,
[email protected]5349ac6d2011-04-05 22:20:1779 std::string) // base64 encoded image contents
80
[email protected]026d452a2011-03-04 18:12:3481// Tell the utility process to render the given PDF into a metafile.
[email protected]da00dc12011-10-06 21:39:2682IPC_MESSAGE_CONTROL4(ChromeUtilityMsg_RenderPDFPagesToMetafile,
[email protected]026d452a2011-03-04 18:12:3483 base::PlatformFile, // PDF file
84 FilePath, // Location for output metafile
[email protected]da00dc12011-10-06 21:39:2685 printing::PdfRenderSettings, // PDF render settitngs
[email protected]026d452a2011-03-04 18:12:3486 std::vector<printing::PageRange>)
87
[email protected]11f16d102012-08-29 23:12:1588// Tell the utility process to decode the given JPEG image data with a robust
89// libjpeg codec.
90IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_RobustJPEGDecodeImage,
91 std::vector<unsigned char>) // encoded image contents
92
[email protected]5349ac6d2011-04-05 22:20:1793// Tell the utility process to parse a JSON string into a Value object.
[email protected]2ccf45c2011-08-19 23:35:5094IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseJSON,
[email protected]5349ac6d2011-04-05 22:20:1795 std::string /* JSON to parse */)
96
[email protected]026d452a2011-03-04 18:12:3497// Tells the utility process to get capabilities and defaults for the specified
98// printer. Used on Windows to isolate the service process from printer driver
99// crashes by executing this in a separate process. This does not run in a
100// sandbox.
[email protected]2ccf45c2011-08-19 23:35:50101IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
[email protected]026d452a2011-03-04 18:12:34102 std::string /* printer name */)
103
104//------------------------------------------------------------------------------
105// Utility process host messages:
106// These are messages from the utility process to the browser.
107// Reply when the utility process is done unpacking an extension. |manifest|
108// is the parsed manifest.json file.
109// The unpacker should also have written out files containing the decoded
[email protected]b3fe68d2012-07-16 19:14:39110// images and message catalogs from the extension. See extensions::Unpacker for
[email protected]026d452a2011-03-04 18:12:34111// details.
[email protected]2ccf45c2011-08-19 23:35:50112IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Succeeded,
[email protected]026d452a2011-03-04 18:12:34113 DictionaryValue /* manifest */)
114
115// Reply when the utility process has failed while unpacking an extension.
116// |error_message| is a user-displayable explanation of what went wrong.
[email protected]2ccf45c2011-08-19 23:35:50117IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackExtension_Failed,
[email protected]fc670822011-12-17 09:33:49118 string16 /* error_message, if any */)
[email protected]026d452a2011-03-04 18:12:34119
120// Reply when the utility process is done unpacking and parsing JSON data
121// from a web resource.
[email protected]2ccf45c2011-08-19 23:35:50122IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Succeeded,
[email protected]026d452a2011-03-04 18:12:34123 DictionaryValue /* json data */)
124
125// Reply when the utility process has failed while unpacking and parsing a
126// web resource. |error_message| is a user-readable explanation of what
127// went wrong.
[email protected]2ccf45c2011-08-19 23:35:50128IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed,
[email protected]026d452a2011-03-04 18:12:34129 std::string /* error_message, if any */)
130
131// Reply when the utility process has succeeded in parsing an update manifest
132// xml document.
[email protected]2ccf45c2011-08-19 23:35:50133IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded,
[email protected]026d452a2011-03-04 18:12:34134 UpdateManifest::Results /* updates */)
135
136// Reply when an error occured parsing the update manifest. |error_message|
137// is a description of what went wrong suitable for logging.
[email protected]2ccf45c2011-08-19 23:35:50138IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseUpdateManifest_Failed,
[email protected]026d452a2011-03-04 18:12:34139 std::string /* error_message, if any */)
140
141// Reply when the utility process has succeeded in decoding the image.
[email protected]2ccf45c2011-08-19 23:35:50142IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Succeeded,
[email protected]026d452a2011-03-04 18:12:34143 SkBitmap) // decoded image
144
145// Reply when an error occured decoding the image.
[email protected]2ccf45c2011-08-19 23:35:50146IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_DecodeImage_Failed)
[email protected]026d452a2011-03-04 18:12:34147
148// Reply when the utility process has succeeded in rendering the PDF.
[email protected]1a30dd32012-01-28 00:56:43149IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Succeeded,
150 int, // Highest rendered page number
151 double) // Scale factor
[email protected]026d452a2011-03-04 18:12:34152
153// Reply when an error occured rendering the PDF.
[email protected]2ccf45c2011-08-19 23:35:50154IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_RenderPDFPagesToMetafile_Failed)
[email protected]026d452a2011-03-04 18:12:34155
[email protected]5349ac6d2011-04-05 22:20:17156// Reply when the utility process successfully parsed a JSON string.
157//
158// WARNING: The result can be of any Value subclass type, but we can't easily
159// pass indeterminate value types by const object reference with our IPC macros,
160// so we put the result Value into a ListValue. Handlers should examine the
161// first (and only) element of the ListValue for the actual result.
[email protected]2ccf45c2011-08-19 23:35:50162IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Succeeded,
[email protected]5349ac6d2011-04-05 22:20:17163 ListValue)
164
165// Reply when the utility process failed in parsing a JSON string.
[email protected]2ccf45c2011-08-19 23:35:50166IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Failed,
[email protected]5349ac6d2011-04-05 22:20:17167 std::string /* error message, if any*/)
168
[email protected]658677f2012-06-09 06:04:02169#if defined(ENABLE_PRINTING)
[email protected]026d452a2011-03-04 18:12:34170// Reply when the utility process has succeeded in obtaining the printer
171// capabilities and defaults.
[email protected]2ccf45c2011-08-19 23:35:50172IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded,
[email protected]026d452a2011-03-04 18:12:34173 std::string /* printer name */,
174 printing::PrinterCapsAndDefaults)
[email protected]658677f2012-06-09 06:04:02175#endif
[email protected]026d452a2011-03-04 18:12:34176
177// Reply when the utility process has failed to obtain the printer
178// capabilities and defaults.
[email protected]2ccf45c2011-08-19 23:35:50179IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed,
[email protected]026d452a2011-03-04 18:12:34180 std::string /* printer name */)