Add MetricsService::WasLastShutdownClean()
[chromium-blink-merge.git] / chrome / common / chrome_utility_messages.h
blobf67c63db118ab453bf13cf01e1f0ceb1ef6af359
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.
7 #if defined(OS_WIN)
8 #include <Windows.h>
9 #endif // defined(OS_WIN)
11 #include <string>
12 #include <vector>
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"
27 #endif
29 // Singly-included section for typedefs.
30 #ifndef CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
31 #define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
33 #if defined(OS_WIN)
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<base::Tuple<base::string16, base::string16>>
37 GetOpenFileNameFilter;
38 #endif // OS_WIN
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_REPEATED_COMPLEX_MEMBER(signed_data)
70 IPC_PROTOBUF_MESSAGE_TRAITS_END()
72 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
73 safe_browsing::ClientDownloadRequest_PEImageHeaders_DebugData)
74 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(directory_entry)
75 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(raw_data)
76 IPC_PROTOBUF_MESSAGE_TRAITS_END()
78 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
79 safe_browsing::ClientDownloadRequest_PEImageHeaders)
80 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(dos_header)
81 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(file_header)
82 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(optional_headers32)
83 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(optional_headers64)
84 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(section_header)
85 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(export_section_data)
86 IPC_PROTOBUF_MESSAGE_TRAITS_REPEATED_COMPLEX_MEMBER(debug_data)
87 IPC_PROTOBUF_MESSAGE_TRAITS_END()
89 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
90 safe_browsing::ClientDownloadRequest_ImageHeaders)
91 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(pe_headers)
92 IPC_PROTOBUF_MESSAGE_TRAITS_END()
94 IPC_PROTOBUF_MESSAGE_TRAITS_BEGIN(
95 safe_browsing::ClientDownloadRequest_ArchivedBinary)
96 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(file_basename)
97 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(download_type)
98 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(digests)
99 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_FUNDAMENTAL_MEMBER(length)
100 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(signature)
101 IPC_PROTOBUF_MESSAGE_TRAITS_OPTIONAL_COMPLEX_MEMBER(image_headers)
102 IPC_PROTOBUF_MESSAGE_TRAITS_END()
104 IPC_STRUCT_TRAITS_BEGIN(safe_browsing::zip_analyzer::Results)
105 IPC_STRUCT_TRAITS_MEMBER(success)
106 IPC_STRUCT_TRAITS_MEMBER(has_executable)
107 IPC_STRUCT_TRAITS_MEMBER(has_archive)
108 IPC_STRUCT_TRAITS_MEMBER(archived_binary)
109 IPC_STRUCT_TRAITS_END()
110 #endif // FULL_SAFE_BROWSING
112 #if defined(OS_WIN)
113 IPC_STRUCT_BEGIN(ChromeUtilityMsg_GetSaveFileName_Params)
114 IPC_STRUCT_MEMBER(HWND, owner)
115 IPC_STRUCT_MEMBER(DWORD, flags)
116 IPC_STRUCT_MEMBER(GetOpenFileNameFilter, filters)
117 IPC_STRUCT_MEMBER(int, one_based_filter_index)
118 IPC_STRUCT_MEMBER(base::FilePath, suggested_filename)
119 IPC_STRUCT_MEMBER(base::FilePath, initial_directory)
120 IPC_STRUCT_MEMBER(base::string16, default_extension)
121 IPC_STRUCT_END()
122 #endif // OS_WIN
124 //------------------------------------------------------------------------------
125 // Utility process messages:
126 // These are messages from the browser to the utility process.
128 // Tell the utility process to decode the given image data.
129 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_DecodeImage,
130 std::vector<unsigned char> /* encoded image contents */,
131 bool /* shrink image if needed for IPC msg limit */,
132 int /* delegate id */)
134 #if defined(OS_CHROMEOS)
135 // Tell the utility process to decode the given JPEG image data with a robust
136 // libjpeg codec.
137 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RobustJPEGDecodeImage,
138 std::vector<unsigned char> /* encoded image contents*/,
139 int /* delegate id */)
140 #endif // defined(OS_CHROMEOS)
142 // Tell the utility process to patch the given |input_file| using |patch_file|
143 // and place the output in |output_file|. The patch should use the bsdiff
144 // algorithm (Courgette's version).
145 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff,
146 base::FilePath /* input_file */,
147 base::FilePath /* patch_file */,
148 base::FilePath /* output_file */)
150 // Tell the utility process to patch the given |input_file| using |patch_file|
151 // and place the output in |output_file|. The patch should use the Courgette
152 // algorithm.
153 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette,
154 base::FilePath /* input_file */,
155 base::FilePath /* patch_file */,
156 base::FilePath /* output_file */)
158 #if defined(OS_CHROMEOS)
159 // Tell the utility process to create a zip file on the given list of files.
160 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_CreateZipFile,
161 base::FilePath /* src_dir */,
162 std::vector<base::FilePath> /* src_relative_paths */,
163 base::FileDescriptor /* dest_fd */)
164 #endif // defined(OS_CHROMEOS)
166 // Requests the utility process to respond with a
167 // ChromeUtilityHostMsg_ProcessStarted message once it has started. This may
168 // be used if the host process needs a handle to the running utility process.
169 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_StartupPing)
171 #if defined(FULL_SAFE_BROWSING)
172 // Tells the utility process to analyze a zip file for malicious download
173 // protection, providing a file that can be used temporarily to analyze binaries
174 // contained therein.
175 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
176 IPC::PlatformFileForTransit /* zip_file */,
177 IPC::PlatformFileForTransit /* temp_file */)
178 #endif
180 #if defined(OS_WIN)
181 // Invokes ui::base::win::OpenFileViaShell from the utility process.
182 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenFileViaShell,
183 base::FilePath /* full_path */)
185 // Invokes ui::base::win::OpenFolderViaShell from the utility process.
186 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenFolderViaShell,
187 base::FilePath /* full_path */)
189 // Instructs the utility process to invoke GetOpenFileName. |owner| is the
190 // parent of the modal dialog, |flags| are OFN_* flags. |filter| constrains the
191 // user's file choices. |initial_directory| and |filename| select the directory
192 // to be displayed and the file to be initially selected.
194 // Either ChromeUtilityHostMsg_GetOpenFileName_Failed or
195 // ChromeUtilityHostMsg_GetOpenFileName_Result will be returned when the
196 // operation completes whether due to error or user action.
197 IPC_MESSAGE_CONTROL5(ChromeUtilityMsg_GetOpenFileName,
198 HWND /* owner */,
199 DWORD /* flags */,
200 GetOpenFileNameFilter /* filter */,
201 base::FilePath /* initial_directory */,
202 base::FilePath /* filename */)
203 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetSaveFileName,
204 ChromeUtilityMsg_GetSaveFileName_Params /* params */)
205 #endif // defined(OS_WIN)
207 //------------------------------------------------------------------------------
208 // Utility process host messages:
209 // These are messages from the utility process to the browser.
211 // Reply when the utility process has failed while unpacking and parsing a
212 // web resource. |error_message| is a user-readable explanation of what
213 // went wrong.
214 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed,
215 std::string /* error_message, if any */)
217 // Reply when the utility process has succeeded in decoding the image.
218 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_DecodeImage_Succeeded,
219 SkBitmap /* decoded image */,
220 int /* delegate id */)
222 // Reply when an error occurred decoding the image.
223 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Failed,
224 int /* delegate id */)
226 // Reply when a file has been patched.
227 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_PatchFile_Finished, int /* result */)
229 #if defined(OS_CHROMEOS)
230 // Reply when the utility process has succeeded in creating the zip file.
231 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Succeeded)
233 // Reply when an error occured in creating the zip file.
234 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Failed)
235 #endif // defined(OS_CHROMEOS)
237 // Reply when the utility process has started.
238 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ProcessStarted)
240 #if defined(FULL_SAFE_BROWSING)
241 // Reply when a zip file has been analyzed for malicious download protection.
242 IPC_MESSAGE_CONTROL1(
243 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished,
244 safe_browsing::zip_analyzer::Results)
245 #endif
247 #if defined(OS_WIN)
248 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetOpenFileName_Failed)
249 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetOpenFileName_Result,
250 base::FilePath /* directory */,
251 std::vector<base::FilePath> /* filenames */)
252 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetSaveFileName_Failed)
253 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetSaveFileName_Result,
254 base::FilePath /* path */,
255 int /* one_based_filter_index */)
256 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_BuildDirectWriteFontCache,
257 base::FilePath /* cache file path */)
258 #endif // defined(OS_WIN)