Webview should only allow resources loading from the extension that embedded it.
[chromium-blink-merge.git] / chrome / common / extensions / chrome_utility_extensions_messages.h
blob6613e478e84e06835895048c5f7a1afeb989d866
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.
78 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_UnzipToDir,
79 base::FilePath /* zip_file */,
80 base::FilePath /* dir */)
82 #if defined(OS_WIN)
83 // Tell the utility process to parse the iTunes preference XML file contents
84 // and return the path to the iTunes directory.
85 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesPrefXml,
86 std::string /* XML to parse */)
87 #endif // defined(OS_WIN)
89 #if defined(OS_MACOSX)
90 // Tell the utility process to parse the iPhoto library XML file and
91 // return the parse result as well as the iPhoto library as an iphoto::Library.
92 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseIPhotoLibraryXmlFile,
93 IPC::PlatformFileForTransit /* XML file to parse */)
94 #endif // defined(OS_MACOSX)
96 #if defined(OS_WIN) || defined(OS_MACOSX)
97 // Tell the utility process to parse the iTunes library XML file and
98 // return the parse result as well as the iTunes library as an itunes::Library.
99 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParseITunesLibraryXmlFile,
100 IPC::PlatformFileForTransit /* XML file to parse */)
102 // Tells the utility process to parse the Picasa PMP database and return a
103 // listing of the user's Picasa albums and folders, along with metadata.
104 IPC_MESSAGE_CONTROL1(ChromeUtilityMsg_ParsePicasaPMPDatabase,
105 picasa::AlbumTableFilesForTransit /* album_table_files */)
107 // Tells the utility process to index the Picasa user-created Album contents
108 // by parsing all the INI files in Picasa Folders.
109 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_IndexPicasaAlbumsContents,
110 picasa::AlbumUIDSet /* album_uids */,
111 std::vector<picasa::FolderINIContents> /* folders_inis */)
112 #endif // defined(OS_WIN) || defined(OS_MACOSX)
114 // Tell the utility process to attempt to validate the passed media file. The
115 // file will undergo basic sanity checks and will be decoded for up to
116 // |milliseconds_of_decoding| wall clock time. It is still not safe to decode
117 // the file in the browser process after this check.
118 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_CheckMediaFile,
119 int64 /* milliseconds_of_decoding */,
120 IPC::PlatformFileForTransit /* Media file to parse */)
122 IPC_MESSAGE_CONTROL3(ChromeUtilityMsg_ParseMediaMetadata,
123 std::string /* mime_type */,
124 int64 /* total_size */,
125 bool /* get_attached_images */)
127 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_RequestBlobBytes_Finished,
128 int64 /* request_id */,
129 std::string /* bytes */)
131 // Requests that the utility process write the contents of the source file to
132 // the removable drive listed in the target file. The target will be restricted
133 // to removable drives by the utility process.
134 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Write,
135 base::FilePath /* source file */,
136 base::FilePath /* target file */)
138 // Requests that the utility process verify that the contents of the source file
139 // was written to the target. As above the target will be restricted to
140 // removable drives by the utility process.
141 IPC_MESSAGE_CONTROL2(ChromeUtilityMsg_ImageWriter_Verify,
142 base::FilePath /* source file */,
143 base::FilePath /* target file */)
145 // Cancels a pending write or verify operation.
146 IPC_MESSAGE_CONTROL0(ChromeUtilityMsg_ImageWriter_Cancel)
148 //------------------------------------------------------------------------------
149 // Utility process host messages:
150 // These are messages from the utility process to the browser.
152 // Reply when the utility process is done unzipping a file. |unpacked_path|
153 // is the directory which contains the unzipped contents.
154 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnzipToDir_Succeeded,
155 base::FilePath /* unpacked_path */)
157 // Reply when the utility process failed to unzip a file. |error| contains
158 // an error string to be reported to the user.
159 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_UnzipToDir_Failed,
160 std::string /* error */)
162 #if defined(OS_WIN)
163 // Reply after parsing the iTunes preferences XML file contents with either the
164 // path to the iTunes directory or an empty FilePath.
165 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GotITunesDirectory,
166 base::FilePath /* Path to iTunes library */)
167 #endif // defined(OS_WIN)
169 #if defined(OS_MACOSX)
170 // Reply after parsing the iPhoto library XML file with the parser result and
171 // an iphoto::Library data structure.
172 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotIPhotoLibrary,
173 bool /* Parser result */,
174 iphoto::parser::Library /* iPhoto library */)
175 #endif // defined(OS_MACOSX)
177 #if defined(OS_WIN) || defined(OS_MACOSX)
178 // Reply after parsing the iTunes library XML file with the parser result and
179 // an itunes::Library data structure.
180 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotITunesLibrary,
181 bool /* Parser result */,
182 itunes::parser::Library /* iTunes library */)
184 // Reply after parsing the Picasa PMP Database with the parser result and a
185 // listing of the user's Picasa albums and folders, along with metadata.
186 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_ParsePicasaPMPDatabase_Finished,
187 bool /* parse_success */,
188 std::vector<picasa::AlbumInfo> /* albums */,
189 std::vector<picasa::AlbumInfo> /* folders */)
191 // Reply after indexing the Picasa user-created Album contents by parsing all
192 // the INI files in Picasa Folders.
193 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_IndexPicasaAlbumsContents_Finished,
194 picasa::AlbumImagesMap /* albums_images */)
195 #endif // defined(OS_WIN) || defined(OS_MACOSX)
197 // Reply after checking the passed media file. A true result indicates that
198 // the file appears to be a well formed media file.
199 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_CheckMediaFile_Finished,
200 bool /* passed_checks */)
202 IPC_MESSAGE_CONTROL3(
203 ChromeUtilityHostMsg_ParseMediaMetadata_Finished,
204 bool /* parse_success */,
205 base::DictionaryValue /* metadata */,
206 std::vector<metadata::AttachedImage> /* attached_images */)
208 IPC_MESSAGE_CONTROL3(ChromeUtilityHostMsg_RequestBlobBytes,
209 int64 /* request_id */,
210 int64 /* start_byte */,
211 int64 /* length */)
213 // Reply when a write or verify operation succeeds.
214 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Succeeded)
216 // Reply when a write or verify operation has been fully cancelled.
217 IPC_MESSAGE_CONTROL0(ChromeUtilityHostMsg_ImageWriter_Cancelled)
219 // Reply when a write or verify operation fails to complete.
220 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Failed,
221 std::string /* message */)
223 // Periodic status update about the progress of an operation.
224 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_ImageWriter_Progress,
225 int64 /* number of bytes processed */)
227 #if defined(OS_WIN)
228 // Get plain-text WiFi credentials from the system (requires UAC privilege
229 // elevation).
230 IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetWiFiCredentials,
231 std::string /* ssid */)
233 // Reply after getting WiFi credentials from the system. |success| is false if
234 // error occurred.
235 IPC_MESSAGE_CONTROL2(ChromeUtilityHostMsg_GotWiFiCredentials,
236 std::string /* key_data */,
237 bool /* success */)
238 #endif // defined(OS_WIN)