Revert of Create a new AccountTrackerService (patchset #8 of https://codereview.chrom...
[chromium-blink-merge.git] / chrome / common / chrome_utility_messages.h
blob352d12bf4dd3e058232de09e6e7e17f682d4b1e8
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.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 #define IPC_MESSAGE_START ChromeUtilityMsgStart
26 #ifndef CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
27 #define CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
29 typedef std::vector<Tuple2<SkBitmap, base::FilePath> > DecodedImages;
31 #endif // CHROME_COMMON_CHROME_UTILITY_MESSAGES_H_
33 IPC_STRUCT_TRAITS_BEGIN(safe_browsing::zip_analyzer::Results)
34 IPC_STRUCT_TRAITS_MEMBER(success)
35 IPC_STRUCT_TRAITS_MEMBER(has_executable)
36 IPC_STRUCT_TRAITS_MEMBER(has_archive)
37 IPC_STRUCT_TRAITS_END()
39 //------------------------------------------------------------------------------
40 // Utility process messages:
41 // These are messages from the browser to the utility process.
43 // Tell the utility process to parse the given JSON data and verify its
44 // validity.
45 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_UnpackWebResource,
46 std::string /* JSON data */)
48 // Tell the utility process to decode the given image data.
49 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_DecodeImage,
50 std::vector<unsigned char>) // encoded image contents
52 // Tell the utility process to decode the given JPEG image data with a robust
53 // libjpeg codec.
54 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_RobustJPEGDecodeImage,
55 std::vector<unsigned char>) // encoded image contents
57 // Tell the utility process to patch the given |input_file| using |patch_file|
58 // and place the output in |output_file|. The patch should use the bsdiff
59 // algorithm (Courgette's version).
60 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileBsdiff,
61 base::FilePath /* input_file */,
62 base::FilePath /* patch_file */,
63 base::FilePath /* output_file */)
65 // Tell the utility process to patch the given |input_file| using |patch_file|
66 // and place the output in |output_file|. The patch should use the Courgette
67 // algorithm.
68 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_PatchFileCourgette,
69 base::FilePath /* input_file */,
70 base::FilePath /* patch_file */,
71 base::FilePath /* output_file */)
73 #if defined(OS_CHROMEOS)
74 // Tell the utility process to create a zip file on the given list of files.
75 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_CreateZipFile,
76 base::FilePath /* src_dir */,
77 std::vector<base::FilePath> /* src_relative_paths */,
78 base::FileDescriptor /* dest_fd */)
79 #endif // defined(OS_CHROMEOS)
81 // Requests the utility process to respond with a
82 // ChromeUtilityHostMsg_ProcessStarted message once it has started. This may
83 // be used if the host process needs a handle to the running utility process.
84 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_StartupPing)
86 #if defined(FULL_SAFE_BROWSING)
87 // Tells the utility process to analyze a zip file for malicious download
88 // protection.
89 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_AnalyzeZipFileForDownloadProtection,
90 IPC::PlatformFileForTransit /* zip_file */)
91 #endif
93 #if defined(OS_WIN)
94 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_OpenItemViaShell,
95 base::FilePath /* full_path */)
97 // A vector of filters, each being a Tuple2a display string (i.e. "Text Files")
98 // and a filter pattern (i.e. "*.txt")..
99 typedef std::vector<Tuple2<base::string16, base::string16> >
100 GetOpenFileNameFilter;
102 // Instructs the utility process to invoke GetOpenFileName. |owner| is the
103 // parent of the modal dialog, |flags| are OFN_* flags. |filter| constrains the
104 // user's file choices. |initial_directory| and |filename| select the directory
105 // to be displayed and the file to be initially selected.
107 // Either ChromeUtilityHostMsg_GetOpenFileName_Failed or
108 // ChromeUtilityHostMsg_GetOpenFileName_Result will be returned when the
109 // operation completes whether due to error or user action.
110 IPC_MESSAGE_CONTROL5(ChromeUtilityMsg_GetOpenFileName,
111 HWND /* owner */,
112 DWORD /* flags */,
113 GetOpenFileNameFilter /* filter */,
114 base::FilePath /* initial_directory */,
115 base::FilePath /* filename */)
116 #endif // defined(OS_WIN)
118 //------------------------------------------------------------------------------
119 // Utility process host messages:
120 // These are messages from the utility process to the browser.
122 // Reply when the utility process is done unpacking and parsing JSON data
123 // from a web resource.
124 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Succeeded,
125 base::DictionaryValue /* json data */)
127 // Reply when the utility process has failed while unpacking and parsing a
128 // web resource. |error_message| is a user-readable explanation of what
129 // went wrong.
130 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnpackWebResource_Failed,
131 std::string /* error_message, if any */)
133 // Reply when the utility process has succeeded in decoding the image.
134 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_DecodeImage_Succeeded,
135 SkBitmap) // decoded image
137 // Reply when an error occurred decoding the image.
138 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_DecodeImage_Failed)
140 // Reply when a file has been patched.
141 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_PatchFile_Finished, int /* result */)
143 #if defined(OS_CHROMEOS)
144 // Reply when the utility process has succeeded in creating the zip file.
145 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Succeeded)
147 // Reply when an error occured in creating the zip file.
148 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_CreateZipFile_Failed)
149 #endif // defined(OS_CHROMEOS)
151 // Reply when the utility process has started.
152 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ProcessStarted)
154 #if defined(FULL_SAFE_BROWSING)
155 // Reply when a zip file has been analyzed for malicious download protection.
156 IPC_MESSAGE_CONTROL1(
157 ChromeUtilityHostMsg_AnalyzeZipFileForDownloadProtection_Finished,
158 safe_browsing::zip_analyzer::Results)
159 #endif
161 #if defined(OS_WIN)
162 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_GetOpenFileName_Failed)
163 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GetOpenFileName_Result,
164 base::FilePath /* directory */,
165 std::vector<base::FilePath> /* filenames */)
166 #endif // defined(OS_WIN)