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 // Multiply-included message file, so no include guard.
9 #endif // defined(OS_WIN)
14 #include "base/files/file_path.h"
15 #include "base/strings/string16.h"
16 #include "base/tuple.h"
17 #include "base/values.h"
18 #include "chrome/common/safe_browsing/zip_analyzer_results.h"
19 #include "ipc/ipc_message_macros.h"
20 #include "ipc/ipc_platform_file.h"
21 #include "third_party/skia/include/core/SkBitmap.h"
22 #include "ui/gfx/ipc/gfx_param_traits.h"
24 #if defined(FULL_SAFE_BROWSING)
25 #include "chrome/common/safe_browsing/ipc_protobuf_message_macros.h"
26 #include "chrome/common/safe_browsing/protobuf_message_param_traits.h"
29 // Singly-included section for typedefs.
30 #ifndef CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
31 #define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
34 // A vector of filters, each being a Tuple containing a display string (i.e.
35 // "Text Files") and a filter pattern (i.e. "*.txt").
36 typedef std::vector
<Tuple
<base::string16
, base::string16
>>
37 GetOpenFileNameFilter
;
40 #endif // CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
42 #define IPC_MESSAGE_START ChromeUtilityMsgStart
44 #if defined(FULL_SAFE_BROWSING)
45 IPC_ENUM_TRAITS_VALIDATE(
46 safe_browsing::ClientDownloadRequest_DownloadType
,
47 safe_browsing::ClientDownloadRequest_DownloadType_IsValid(value
))
49 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(safe_browsing::ClientDownloadRequest_Digests
)
50 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(sha256
)
51 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(sha1
)
52 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(md5
)
53 IPC_PROTOBUF_MESSAGE_TRAITS_END()
55 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
56 safe_browsing::ClientDownloadRequest_CertificateChain_Element
)
57 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(certificate
)
58 IPC_PROTOBUF_MESSAGE_TRAITS_END()
60 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
61 safe_browsing::ClientDownloadRequest_CertificateChain
)
62 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(element
)
63 IPC_PROTOBUF_MESSAGE_TRAITS_END()
65 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
66 safe_browsing::ClientDownloadRequest_SignatureInfo
)
67 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(certificate_chain
)
68 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(trusted
)
69 IPC_PROTOBUF_MESSAGE_TRAITS_END()
71 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
72 safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData
)
73 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(directory_entry
)
74 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(raw_data
)
75 IPC_PROTOBUF_MESSAGE_TRAITS_END()
77 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
78 safe_browsing::ClientDownloadRequest_PEImageHeaders
)
79 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(dos_header
)
80 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(file_header
)
81 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(optional_headers32
)
82 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(optional_headers64
)
83 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(section_header
)
84 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(export_section_data
)
85 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(debug_data
)
86 IPC_PROTOBUF_MESSAGE_TRAITS_END()
88 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
89 safe_browsing::ClientDownloadRequest_ImageHeaders
)
90 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(pe_headers
)
91 IPC_PROTOBUF_MESSAGE_TRAITS_END()
93 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
94 safe_browsing::ClientDownloadRequest_ArchivedBinary
)
95 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(file_basename
)
96 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(download_type
)
97 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(digests
)
98 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(length
)
99 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(signature
)
100 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(image_headers
)
101 IPC_PROTOBUF_MESSAGE_TRAITS_END()
103 IPC_STRUCT_TRAITS_BEGIN(safe_browsing::zip_analyzer::Results
)
104 IPC_STRUCT_TRAITS_MEMBER(success
)
105 IPC_STRUCT_TRAITS_MEMBER(has_executable
)
106 IPC_STRUCT_TRAITS_MEMBER(has_archive
)
107 IPC_STRUCT_TRAITS_MEMBER(archived_binary
)
108 IPC_STRUCT_TRAITS_END()
109 #endif // FULL_SAFE_BROWSING
112 IPC_STRUCT_BEGIN(ChromeUtilityMsg_GetSaveFileName_Params
)
113 IPC_STRUCT_MEMBER(HWND
, owner
)
114 IPC_STRUCT_MEMBER(DWORD
, flags
)
115 IPC_STRUCT_MEMBER(GetOpenFileNameFilter
, filters
)
116 IPC_STRUCT_MEMBER(int, one_based_filter_index
)
117 IPC_STRUCT_MEMBER(base::FilePath
, suggested_filename
)
118 IPC_STRUCT_MEMBER(base::FilePath
, initial_directory
)
119 IPC_STRUCT_MEMBER(base::string16
, default_extension
)
123 //------------------------------------------------------------------------------
124 // Utility process messages:
125 // These are messages from the browser to the utility process.
127 // Tell the utility process to parse a JSON string into a Value object.
128 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseJSON
,
129 std::string
/* JSON to parse */)
131 // Tell the utility process to decode the given image data.
132 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_DecodeImage
,
133 std::vector
<unsigned char> /* encoded image contents */,
134 bool /* shrink image if needed for IPC msg limit */,
135 int /* delegate id */)
137 // Tell the utility process to decode the given JPEG image data with a robust
139 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RobustJPEGDecodeImage
,
140 std::vector
<unsigned char> /* encoded image contents*/,
141 int /* delegate id */)
143 // Tell the utility process to patch the given |input_file| using |patch_file|
144 // and place the output in |output_file|. The patch should use the bsdiff
145 // algorithm (Courgette's version).
146 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff
,
147 base::FilePath
/* input_file */,
148 base::FilePath
/* patch_file */,
149 base::FilePath
/* output_file */)
151 // Tell the utility process to patch the given |input_file| using |patch_file|
152 // and place the output in |output_file|. The patch should use the Courgette
154 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette
,
155 base::FilePath
/* input_file */,
156 base::FilePath
/* patch_file */,
157 base::FilePath
/* output_file */)
159 #if defined(OS_CHROMEOS)
160 // Tell the utility process to create a zip file on the given list of files.
161 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_CreateZipFile
,
162 base::FilePath
/* src_dir */,
163 std::vector
<base::FilePath
> /* src_relative_paths */,
164 base::FileDescriptor
/* dest_fd */)
165 #endif // defined(OS_CHROMEOS)
167 // Requests the utility process to respond with a
168 // ChromeUtilityHostMsg_ProcessStarted message once it has started. This may
169 // be used if the host process needs a handle to the running utility process.
170 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_StartupPing
)
172 #if defined(FULL_SAFE_BROWSING)
173 // Tells the utility process to analyze a zip file for malicious download
174 // protection, providing a file that can be used temporarily to analyze binaries
175 // contained therein.
176 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection
,
177 IPC::PlatformFileForTransit
/* zip_file */,
178 IPC::PlatformFileForTransit
/* temp_file */)
182 // Invokes ui::base::win::OpenFileViaShell from the utility process.
183 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenFileViaShell
,
184 base::FilePath
/* full_path */)
186 // Invokes ui::base::win::OpenFolderViaShell from the utility process.
187 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenFolderViaShell
,
188 base::FilePath
/* full_path */)
190 // Instructs the utility process to invoke GetOpenFileName. |owner| is the
191 // parent of the modal dialog, |flags| are OFN_* flags. |filter| constrains the
192 // user's file choices. |initial_directory| and |filename| select the directory
193 // to be displayed and the file to be initially selected.
195 // Either ChromeUtilityHostMsg_GetOpenFileName_Failed or
196 // ChromeUtilityHostMsg_GetOpenFileName_Result will be returned when the
197 // operation completes whether due to error or user action.
198 IPC_MESSAGE_CONTROL5(ChromeUtilityMsg_GetOpenFileName
,
201 GetOpenFileNameFilter
/* filter */,
202 base::FilePath
/* initial_directory */,
203 base::FilePath
/* filename */)
204 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetSaveFileName
,
205 ChromeUtilityMsg_GetSaveFileName_Params
/* params */)
206 #endif // defined(OS_WIN)
208 #if defined(OS_ANDROID)
209 // Instructs the utility process to detect support for seccomp-bpf,
210 // and the result is reported through
211 // ChromeUtilityHostMsg_DetectSeccompSupport_Result.
212 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_DetectSeccompSupport
)
215 //------------------------------------------------------------------------------
216 // Utility process host messages:
217 // These are messages from the utility process to the browser.
219 // Reply when the utility process successfully parsed a JSON string.
221 // WARNING: The result can be of any Value subclass type, but we can't easily
222 // pass indeterminate value types by const object reference with our IPC macros,
223 // so we put the result Value into a ListValue. Handlers should examine the
224 // first (and only) element of the ListValue for the actual result.
225 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Succeeded
,
228 // Reply when the utility process failed in parsing a JSON string.
229 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Failed
,
230 std::string
/* error message, if any*/)
232 // Reply when the utility process has failed while unpacking and parsing a
233 // web resource. |error_message| is a user-readable explanation of what
235 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed
,
236 std::string
/* error_message, if any */)
238 // Reply when the utility process has succeeded in decoding the image.
239 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_DecodeImage_Succeeded
,
240 SkBitmap
/* decoded image */,
241 int /* delegate id */)
243 // Reply when an error occurred decoding the image.
244 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Failed
,
245 int /* delegate id */)
247 // Reply when a file has been patched.
248 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_PatchFile_Finished
, int /* result */)
250 #if defined(OS_CHROMEOS)
251 // Reply when the utility process has succeeded in creating the zip file.
252 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Succeeded
)
254 // Reply when an error occured in creating the zip file.
255 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Failed
)
256 #endif // defined(OS_CHROMEOS)
258 // Reply when the utility process has started.
259 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ProcessStarted
)
261 #if defined(FULL_SAFE_BROWSING)
262 // Reply when a zip file has been analyzed for malicious download protection.
263 IPC_MESSAGE_CONTROL1(
264 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished
,
265 safe_browsing::zip_analyzer::Results
)
269 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetOpenFileName_Failed
)
270 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetOpenFileName_Result
,
271 base::FilePath
/* directory */,
272 std::vector
<base::FilePath
> /* filenames */)
273 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetSaveFileName_Failed
)
274 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetSaveFileName_Result
,
275 base::FilePath
/* path */,
276 int /* one_based_filter_index */)
277 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_BuildDirectWriteFontCache
,
278 base::FilePath
/* cache file path */)
279 #endif // defined(OS_WIN)
281 #if defined(OS_ANDROID)
282 // Reply to ChromeUtilityMsg_DetectSeccompSupport to report the level
283 // of kernel support for seccomp-bpf.
284 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DetectSeccompSupport_ResultPrctl
,
285 bool /* seccomp prctl supported */)
286 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DetectSeccompSupport_ResultSyscall
,
287 bool /* seccomp syscall supported */)