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.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 // Singly-included section for typedefs.
25 #ifndef CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
26 #define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
29 // A vector of filters, each being a Tuple containing a display string (i.e.
30 // "Text Files") and a filter pattern (i.e. "*.txt").
31 typedef std::vector
<Tuple
<base::string16
, base::string16
>>
32 GetOpenFileNameFilter
;
35 #endif // CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
37 #define IPC_MESSAGE_START ChromeUtilityMsgStart
39 #if defined(FULL_SAFE_BROWSING)
40 IPC_STRUCT_TRAITS_BEGIN(safe_browsing::zip_analyzer::Results
)
41 IPC_STRUCT_TRAITS_MEMBER(success
)
42 IPC_STRUCT_TRAITS_MEMBER(has_executable
)
43 IPC_STRUCT_TRAITS_MEMBER(has_archive
)
44 IPC_STRUCT_TRAITS_END()
48 IPC_STRUCT_BEGIN(ChromeUtilityMsg_GetSaveFileName_Params
)
49 IPC_STRUCT_MEMBER(HWND
, owner
)
50 IPC_STRUCT_MEMBER(DWORD
, flags
)
51 IPC_STRUCT_MEMBER(GetOpenFileNameFilter
, filters
)
52 IPC_STRUCT_MEMBER(int, one_based_filter_index
)
53 IPC_STRUCT_MEMBER(base::FilePath
, suggested_filename
)
54 IPC_STRUCT_MEMBER(base::FilePath
, initial_directory
)
55 IPC_STRUCT_MEMBER(base::string16
, default_extension
)
59 //------------------------------------------------------------------------------
60 // Utility process messages:
61 // These are messages from the browser to the utility process.
63 // Tell the utility process to parse a JSON string into a Value object.
64 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseJSON
,
65 std::string
/* JSON to parse */)
67 // Tell the utility process to decode the given image data.
68 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_DecodeImage
,
69 std::vector
<unsigned char> /* encoded image contents */,
70 bool /* shrink image if needed for IPC msg limit */)
72 // Tell the utility process to decode the given JPEG image data with a robust
74 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_RobustJPEGDecodeImage
,
75 std::vector
<unsigned char>) // encoded image contents
77 // Tell the utility process to patch the given |input_file| using |patch_file|
78 // and place the output in |output_file|. The patch should use the bsdiff
79 // algorithm (Courgette's version).
80 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff
,
81 base::FilePath
/* input_file */,
82 base::FilePath
/* patch_file */,
83 base::FilePath
/* output_file */)
85 // Tell the utility process to patch the given |input_file| using |patch_file|
86 // and place the output in |output_file|. The patch should use the Courgette
88 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette
,
89 base::FilePath
/* input_file */,
90 base::FilePath
/* patch_file */,
91 base::FilePath
/* output_file */)
93 #if defined(OS_CHROMEOS)
94 // Tell the utility process to create a zip file on the given list of files.
95 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_CreateZipFile
,
96 base::FilePath
/* src_dir */,
97 std::vector
<base::FilePath
> /* src_relative_paths */,
98 base::FileDescriptor
/* dest_fd */)
99 #endif // defined(OS_CHROMEOS)
101 // Requests the utility process to respond with a
102 // ChromeUtilityHostMsg_ProcessStarted message once it has started. This may
103 // be used if the host process needs a handle to the running utility process.
104 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_StartupPing
)
106 #if defined(FULL_SAFE_BROWSING)
107 // Tells the utility process to analyze a zip file for malicious download
109 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection
,
110 IPC::PlatformFileForTransit
/* zip_file */)
114 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenItemViaShell
,
115 base::FilePath
/* full_path */)
117 // Instructs the utility process to invoke GetOpenFileName. |owner| is the
118 // parent of the modal dialog, |flags| are OFN_* flags. |filter| constrains the
119 // user's file choices. |initial_directory| and |filename| select the directory
120 // to be displayed and the file to be initially selected.
122 // Either ChromeUtilityHostMsg_GetOpenFileName_Failed or
123 // ChromeUtilityHostMsg_GetOpenFileName_Result will be returned when the
124 // operation completes whether due to error or user action.
125 IPC_MESSAGE_CONTROL5(ChromeUtilityMsg_GetOpenFileName
,
128 GetOpenFileNameFilter
/* filter */,
129 base::FilePath
/* initial_directory */,
130 base::FilePath
/* filename */)
131 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_GetSaveFileName
,
132 ChromeUtilityMsg_GetSaveFileName_Params
/* params */)
133 #endif // defined(OS_WIN)
135 //------------------------------------------------------------------------------
136 // Utility process host messages:
137 // These are messages from the utility process to the browser.
139 // Reply when the utility process successfully parsed a JSON string.
141 // WARNING: The result can be of any Value subclass type, but we can't easily
142 // pass indeterminate value types by const object reference with our IPC macros,
143 // so we put the result Value into a ListValue. Handlers should examine the
144 // first (and only) element of the ListValue for the actual result.
145 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Succeeded
,
148 // Reply when the utility process failed in parsing a JSON string.
149 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ParseJSON_Failed
,
150 std::string
/* error message, if any*/)
152 // Reply when the utility process has failed while unpacking and parsing a
153 // web resource. |error_message| is a user-readable explanation of what
155 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed
,
156 std::string
/* error_message, if any */)
158 // Reply when the utility process has succeeded in decoding the image.
159 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Succeeded
,
160 SkBitmap
) // decoded image
162 // Reply when an error occurred decoding the image.
163 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_DecodeImage_Failed
)
165 // Reply when a file has been patched.
166 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_PatchFile_Finished
, int /* result */)
168 #if defined(OS_CHROMEOS)
169 // Reply when the utility process has succeeded in creating the zip file.
170 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Succeeded
)
172 // Reply when an error occured in creating the zip file.
173 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Failed
)
174 #endif // defined(OS_CHROMEOS)
176 // Reply when the utility process has started.
177 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ProcessStarted
)
179 #if defined(FULL_SAFE_BROWSING)
180 // Reply when a zip file has been analyzed for malicious download protection.
181 IPC_MESSAGE_CONTROL1(
182 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished
,
183 safe_browsing::zip_analyzer::Results
)
187 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetOpenFileName_Failed
)
188 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetOpenFileName_Result
,
189 base::FilePath
/* directory */,
190 std::vector
<base::FilePath
> /* filenames */)
191 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetSaveFileName_Failed
)
192 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetSaveFileName_Result
,
193 base::FilePath
/* path */,
194 int /* one_based_filter_index */)
195 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_BuildDirectWriteFontCache
,
196 base::FilePath
/* cache file path */)
197 #endif // defined(OS_WIN)