Move UnzipToDir IPC code to top-level extensions directory
[chromium-blink-merge.git] / chrome / common / extensions / chrome_utility_extensions_messages.h
blob95cdee38a22d8c178532e86f5e9b291bab07a210
1 // Copyright 2014 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 #include <string>
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/files/file_path.h"
12 #include "chrome/common/media_galleries/iphoto_library.h"
13 #include "chrome/common/media_galleries/itunes_library.h"
14 #include "chrome/common/media_galleries/metadata_types.h"
15 #include "chrome/common/media_galleries/picasa_types.h"
16 #include "ipc/ipc_message_macros.h"
17 #include "ipc/ipc_platform_file.h"
19 #if !defined(ENABLE_EXTENSIONS)
20 #error "Extensions must be enabled"
21 #endif
23 #define IPC_MESSAGE_START ChromeUtilityExtensionsMsgStart
25 #if defined(OS_MACOSX)
26 IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Photo)
27 IPC_STRUCT_TRAITS_MEMBER(id)
28 IPC_STRUCT_TRAITS_MEMBER(location)
29 IPC_STRUCT_TRAITS_MEMBER(original_location)
30 IPC_STRUCT_TRAITS_END()
32 IPC_STRUCT_TRAITS_BEGIN(iphoto::parser::Library)
33 IPC_STRUCT_TRAITS_MEMBER(albums)
34 IPC_STRUCT_TRAITS_MEMBER(all_photos)
35 IPC_STRUCT_TRAITS_END()
36 #endif // defined(OS_MACOSX)
38 #if defined(OS_WIN) || defined(OS_MACOSX)
39 IPC_STRUCT_TRAITS_BEGIN(itunes::parser::Track)
40 IPC_STRUCT_TRAITS_MEMBER(id)
41 IPC_STRUCT_TRAITS_MEMBER(location)
42 IPC_STRUCT_TRAITS_END()
44 IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumInfo)
45 IPC_STRUCT_TRAITS_MEMBER(name)
46 IPC_STRUCT_TRAITS_MEMBER(timestamp)
47 IPC_STRUCT_TRAITS_MEMBER(uid)
48 IPC_STRUCT_TRAITS_MEMBER(path)
49 IPC_STRUCT_TRAITS_END()
51 // These files are opened read-only. Please see the constructor for
52 // picasa::AlbumTableFiles for details.
53 IPC_STRUCT_TRAITS_BEGIN(picasa::AlbumTableFilesForTransit)
54 IPC_STRUCT_TRAITS_MEMBER(indicator_file)
55 IPC_STRUCT_TRAITS_MEMBER(category_file)
56 IPC_STRUCT_TRAITS_MEMBER(date_file)
57 IPC_STRUCT_TRAITS_MEMBER(filename_file)
58 IPC_STRUCT_TRAITS_MEMBER(name_file)
59 IPC_STRUCT_TRAITS_MEMBER(token_file)
60 IPC_STRUCT_TRAITS_MEMBER(uid_file)
61 IPC_STRUCT_TRAITS_END()
63 IPC_STRUCT_TRAITS_BEGIN(picasa::FolderINIContents)
64 IPC_STRUCT_TRAITS_MEMBER(folder_path)
65 IPC_STRUCT_TRAITS_MEMBER(ini_contents)
66 IPC_STRUCT_TRAITS_END()
67 #endif // defined(OS_WIN) || defined(OS_MACOSX)
69 IPC_STRUCT_TRAITS_BEGIN(metadata::AttachedImage)
70 IPC_STRUCT_TRAITS_MEMBER(type)
71 IPC_STRUCT_TRAITS_MEMBER(data)
72 IPC_STRUCT_TRAITS_END()
74 //------------------------------------------------------------------------------
75 // Utility process messages:
76 // These are messages from the browser to the utility process.
79 #if defined(OS_WIN)
80 // Tell the utility process to parse the iTunes preference XML file contents
81 // and return the path to the iTunes directory.
82 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesPrefXml,
83 std::string /* XML to parse */)
84 #endif // defined(OS_WIN)
86 #if defined(OS_MACOSX)
87 // Tell the utility process to parse the iPhoto library XML file and
88 // return the parse result as well as the iPhoto library as an iphoto::Library.
89 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseIPhotoLibraryXmlFile,
90 IPC::PlatformFileForTransit /* XML file to parse */)
91 #endif // defined(OS_MACOSX)
93 #if defined(OS_WIN) || defined(OS_MACOSX)
94 // Tell the utility process to parse the iTunes library XML file and
95 // return the parse result as well as the iTunes library as an itunes::Library.
96 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesLibraryXmlFile,
97 IPC::PlatformFileForTransit /* XML file to parse */)
99 // Tells the utility process to parse the Picasa PMP database and return a
100 // listing of the user's Picasa albums and folders, along with metadata.
101 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParsePicasaPMPDatabase,
102 picasa::AlbumTableFilesForTransit /* album_table_files */)
104 // Tells the utility process to index the Picasa user-created Album contents
105 // by parsing all the INI files in Picasa Folders.
106 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents,
107 picasa::AlbumUIDSet /* album_uids */,
108 std::vector<picasa::FolderINIContents> /* folders_inis */)
109 #endif // defined(OS_WIN) || defined(OS_MACOSX)
111 // Tell the utility process to attempt to validate the passed media file. The
112 // file will undergo basic sanity checks and will be decoded for up to
113 // |milliseconds_of_decoding| wall clock time. It is still not safe to decode
114 // the file in the browser process after this check.
115 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_CheckMediaFile,
116 int64 /* milliseconds_of_decoding */,
117 IPC::PlatformFileForTransit /* Media file to parse */)
119 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata,
120 std::string /* mime_type */,
121 int64 /* total_size */,
122 bool /* get_attached_images */)
124 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished,
125 int64 /* request_id */,
126 std::string /* bytes */)
128 // Requests that the utility process write the contents of the source file to
129 // the removable drive listed in the target file. The target will be restricted
130 // to removable drives by the utility process.
131 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Write,
132 base::FilePath /* source file */,
133 base::FilePath /* target file */)
135 // Requests that the utility process verify that the contents of the source file
136 // was written to the target. As above the target will be restricted to
137 // removable drives by the utility process.
138 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Verify,
139 base::FilePath /* source file */,
140 base::FilePath /* target file */)
142 // Cancels a pending write or verify operation.
143 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_ImageWriter_Cancel)
145 //------------------------------------------------------------------------------
146 // Utility process host messages:
147 // These are messages from the utility process to the browser.
149 #if defined(OS_WIN)
150 // Reply after parsing the iTunes preferences XML file contents with either the
151 // path to the iTunes directory or an empty FilePath.
152 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GotITunesDirectory,
153 base::FilePath /* Path to iTunes library */)
154 #endif // defined(OS_WIN)
156 #if defined(OS_MACOSX)
157 // Reply after parsing the iPhoto library XML file with the parser result and
158 // an iphoto::Library data structure.
159 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotIPhotoLibrary,
160 bool /* Parser result */,
161 iphoto::parser::Library /* iPhoto library */)
162 #endif // defined(OS_MACOSX)
164 #if defined(OS_WIN) || defined(OS_MACOSX)
165 // Reply after parsing the iTunes library XML file with the parser result and
166 // an itunes::Library data structure.
167 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotITunesLibrary,
168 bool /* Parser result */,
169 itunes::parser::Library /* iTunes library */)
171 // Reply after parsing the Picasa PMP Database with the parser result and a
172 // listing of the user's Picasa albums and folders, along with metadata.
173 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished,
174 bool /* parse_success */,
175 std::vector<picasa::AlbumInfo> /* albums */,
176 std::vector<picasa::AlbumInfo> /* folders */)
178 // Reply after indexing the Picasa user-created Album contents by parsing all
179 // the INI files in Picasa Folders.
180 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished,
181 picasa::AlbumImagesMap /* albums_images */)
182 #endif // defined(OS_WIN) || defined(OS_MACOSX)
184 // Reply after checking the passed media file. A true result indicates that
185 // the file appears to be a well formed media file.
186 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished,
187 bool /* passed_checks */)
189 IPC_MESSAGE_CONTROL3(
190 ChromeUtilityHostMsg_ParseMediaMetadata_Finished,
191 bool /* parse_success */,
192 base::DictionaryValue /* metadata */,
193 std::vector<metadata::AttachedImage> /* attached_images */)
195 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes,
196 int64 /* request_id */,
197 int64 /* start_byte */,
198 int64 /* length */)
200 // Reply when a write or verify operation succeeds.
201 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded)
203 // Reply when a write or verify operation has been fully cancelled.
204 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Cancelled)
206 // Reply when a write or verify operation fails to complete.
207 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Failed,
208 std::string /* message */)
210 // Periodic status update about the progress of an operation.
211 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Progress,
212 int64 /* number of bytes processed */)
214 #if defined(OS_WIN)
215 // Get plain-text WiFi credentials from the system (requires UAC privilege
216 // elevation).
217 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetWiFiCredentials,
218 std::string /* ssid */)
220 // Reply after getting WiFi credentials from the system. |success| is false if
221 // error occurred.
222 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotWiFiCredentials,
223 std::string /* key_data */,
224 bool /* success */)
225 #endif // defined(OS_WIN)