OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // IPC messages for extensions. | 5 // IPC messages for extensions. |
6 // Multiply-included message file, hence no include guard. | 6 // Multiply-included message file, hence no include guard. |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/common/extensions/api/messaging/message.h" | 13 #include "chrome/common/extensions/api/messaging/message.h" |
14 #include "chrome/common/extensions/permissions/media_galleries_permission_data.h
" | 14 #include "chrome/common/extensions/permissions/media_galleries_permission_data.h
" |
15 #include "chrome/common/extensions/permissions/socket_permission_data.h" | 15 #include "chrome/common/extensions/permissions/socket_permission_data.h" |
16 #include "chrome/common/extensions/permissions/usb_device_permission_data.h" | 16 #include "chrome/common/extensions/permissions/usb_device_permission_data.h" |
17 #include "chrome/common/web_application_info.h" | |
18 #include "content/public/common/common_param_traits.h" | 17 #include "content/public/common/common_param_traits.h" |
19 #include "content/public/common/socket_permission_request.h" | 18 #include "content/public/common/socket_permission_request.h" |
20 #include "extensions/common/draggable_region.h" | 19 #include "extensions/common/draggable_region.h" |
21 #include "extensions/common/extension.h" | 20 #include "extensions/common/extension.h" |
22 #include "extensions/common/extensions_client.h" | 21 #include "extensions/common/extensions_client.h" |
23 #include "extensions/common/permissions/permission_set.h" | 22 #include "extensions/common/permissions/permission_set.h" |
24 #include "extensions/common/url_pattern.h" | 23 #include "extensions/common/url_pattern.h" |
25 #include "extensions/common/url_pattern_set.h" | 24 #include "extensions/common/url_pattern_set.h" |
26 #include "extensions/common/view_type.h" | 25 #include "extensions/common/view_type.h" |
27 #include "ipc/ipc_message_macros.h" | 26 #include "ipc/ipc_message_macros.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Parameters structure for ExtensionMsg_UpdatePermissions. | 152 // Parameters structure for ExtensionMsg_UpdatePermissions. |
154 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params) | 153 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params) |
155 IPC_STRUCT_MEMBER(int /* UpdateExtensionPermissionsInfo::REASON */, reason_id) | 154 IPC_STRUCT_MEMBER(int /* UpdateExtensionPermissionsInfo::REASON */, reason_id) |
156 IPC_STRUCT_MEMBER(std::string, extension_id) | 155 IPC_STRUCT_MEMBER(std::string, extension_id) |
157 IPC_STRUCT_MEMBER(extensions::APIPermissionSet, apis) | 156 IPC_STRUCT_MEMBER(extensions::APIPermissionSet, apis) |
158 IPC_STRUCT_MEMBER(extensions::ManifestPermissionSet, manifest_permissions) | 157 IPC_STRUCT_MEMBER(extensions::ManifestPermissionSet, manifest_permissions) |
159 IPC_STRUCT_MEMBER(extensions::URLPatternSet, explicit_hosts) | 158 IPC_STRUCT_MEMBER(extensions::URLPatternSet, explicit_hosts) |
160 IPC_STRUCT_MEMBER(extensions::URLPatternSet, scriptable_hosts) | 159 IPC_STRUCT_MEMBER(extensions::URLPatternSet, scriptable_hosts) |
161 IPC_STRUCT_END() | 160 IPC_STRUCT_END() |
162 | 161 |
163 IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo::IconInfo) | |
164 IPC_STRUCT_TRAITS_MEMBER(url) | |
165 IPC_STRUCT_TRAITS_MEMBER(width) | |
166 IPC_STRUCT_TRAITS_MEMBER(height) | |
167 IPC_STRUCT_TRAITS_MEMBER(data) | |
168 IPC_STRUCT_TRAITS_END() | |
169 | |
170 IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo) | |
171 IPC_STRUCT_TRAITS_MEMBER(title) | |
172 IPC_STRUCT_TRAITS_MEMBER(description) | |
173 IPC_STRUCT_TRAITS_MEMBER(app_url) | |
174 IPC_STRUCT_TRAITS_MEMBER(icons) | |
175 IPC_STRUCT_TRAITS_END() | |
176 | |
177 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion) | 162 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion) |
178 IPC_STRUCT_TRAITS_MEMBER(draggable) | 163 IPC_STRUCT_TRAITS_MEMBER(draggable) |
179 IPC_STRUCT_TRAITS_MEMBER(bounds) | 164 IPC_STRUCT_TRAITS_MEMBER(bounds) |
180 IPC_STRUCT_TRAITS_END() | 165 IPC_STRUCT_TRAITS_END() |
181 | 166 |
182 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest) | 167 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest) |
183 IPC_STRUCT_TRAITS_MEMBER(type) | 168 IPC_STRUCT_TRAITS_MEMBER(type) |
184 IPC_STRUCT_TRAITS_MEMBER(host) | 169 IPC_STRUCT_TRAITS_MEMBER(host) |
185 IPC_STRUCT_TRAITS_MEMBER(port) | 170 IPC_STRUCT_TRAITS_MEMBER(port) |
186 IPC_STRUCT_TRAITS_END() | 171 IPC_STRUCT_TRAITS_END() |
(...skipping 15 matching lines...) Expand all Loading... |
202 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData) | 187 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData) |
203 IPC_STRUCT_TRAITS_MEMBER(permission()) | 188 IPC_STRUCT_TRAITS_MEMBER(permission()) |
204 IPC_STRUCT_TRAITS_END() | 189 IPC_STRUCT_TRAITS_END() |
205 | 190 |
206 IPC_STRUCT_TRAITS_BEGIN(extensions::Message) | 191 IPC_STRUCT_TRAITS_BEGIN(extensions::Message) |
207 IPC_STRUCT_TRAITS_MEMBER(data) | 192 IPC_STRUCT_TRAITS_MEMBER(data) |
208 IPC_STRUCT_TRAITS_MEMBER(user_gesture) | 193 IPC_STRUCT_TRAITS_MEMBER(user_gesture) |
209 IPC_STRUCT_TRAITS_END() | 194 IPC_STRUCT_TRAITS_END() |
210 | 195 |
211 // Singly-included section for custom IPC traits. | 196 // Singly-included section for custom IPC traits. |
212 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_ | 197 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ |
213 #define CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_ | 198 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ |
214 | 199 |
215 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need | 200 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need |
216 // to typedef it to avoid that. | 201 // to typedef it to avoid that. |
217 // Substitution map for l10n messages. | 202 // Substitution map for l10n messages. |
218 typedef std::map<std::string, std::string> SubstitutionMap; | 203 typedef std::map<std::string, std::string> SubstitutionMap; |
219 | 204 |
220 // Map of extensions IDs to the executing script paths. | 205 // Map of extensions IDs to the executing script paths. |
221 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; | 206 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; |
222 | 207 |
223 struct ExtensionMsg_Loaded_Params { | 208 struct ExtensionMsg_Loaded_Params { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 template <> | 288 template <> |
304 struct ParamTraits<ExtensionMsg_Loaded_Params> { | 289 struct ParamTraits<ExtensionMsg_Loaded_Params> { |
305 typedef ExtensionMsg_Loaded_Params param_type; | 290 typedef ExtensionMsg_Loaded_Params param_type; |
306 static void Write(Message* m, const param_type& p); | 291 static void Write(Message* m, const param_type& p); |
307 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 292 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
308 static void Log(const param_type& p, std::string* l); | 293 static void Log(const param_type& p, std::string* l); |
309 }; | 294 }; |
310 | 295 |
311 } // namespace IPC | 296 } // namespace IPC |
312 | 297 |
313 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_ | 298 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ |
314 | 299 |
315 // Messages sent from the browser to the renderer. | 300 // Messages sent from the browser to the renderer. |
316 | 301 |
317 // The browser sends this message in response to all extension api calls. The | 302 // The browser sends this message in response to all extension api calls. The |
318 // response data (if any) is one of the base::Value subclasses, wrapped as the | 303 // response data (if any) is one of the base::Value subclasses, wrapped as the |
319 // first element in a ListValue. | 304 // first element in a ListValue. |
320 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response, | 305 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response, |
321 int /* request_id */, | 306 int /* request_id */, |
322 bool /* success */, | 307 bool /* success */, |
323 base::ListValue /* response wrapper (see comment above) */, | 308 base::ListValue /* response wrapper (see comment above) */, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // Notification that renderer should run some JavaScript code. | 355 // Notification that renderer should run some JavaScript code. |
371 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode, | 356 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode, |
372 ExtensionMsg_ExecuteCode_Params) | 357 ExtensionMsg_ExecuteCode_Params) |
373 | 358 |
374 // Notification that the user scripts have been updated. It has one | 359 // Notification that the user scripts have been updated. It has one |
375 // SharedMemoryHandle argument consisting of the pickled script data. This | 360 // SharedMemoryHandle argument consisting of the pickled script data. This |
376 // handle is valid in the context of the renderer. | 361 // handle is valid in the context of the renderer. |
377 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdateUserScripts, | 362 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdateUserScripts, |
378 base::SharedMemoryHandle) | 363 base::SharedMemoryHandle) |
379 | 364 |
380 // Requests application info for the page. The renderer responds back with | |
381 // ExtensionHostMsg_DidGetApplicationInfo. | |
382 IPC_MESSAGE_ROUTED1(ExtensionMsg_GetApplicationInfo, | |
383 int32 /*page_id*/) | |
384 | |
385 // Tell the render view which browser window it's being attached to. | 365 // Tell the render view which browser window it's being attached to. |
386 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId, | 366 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId, |
387 int /* id of browser window */) | 367 int /* id of browser window */) |
388 | 368 |
389 // Tell the render view what its tab ID is. | 369 // Tell the render view what its tab ID is. |
390 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, | 370 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, |
391 int /* id of tab */) | 371 int /* id of tab */) |
392 | 372 |
393 // Tell the renderer to update an extension's permission set. | 373 // Tell the renderer to update an extension's permission set. |
394 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions, | 374 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // Sent from the renderer to the browser to notify that content scripts are | 572 // Sent from the renderer to the browser to notify that content scripts are |
593 // running in the renderer that the IPC originated from. | 573 // running in the renderer that the IPC originated from. |
594 // Note that the page_id is for the parent (or more accurately the topmost) | 574 // Note that the page_id is for the parent (or more accurately the topmost) |
595 // frame (e.g. if executing in an iframe this is the page ID of the parent, | 575 // frame (e.g. if executing in an iframe this is the page ID of the parent, |
596 // unless the parent is an iframe... etc). | 576 // unless the parent is an iframe... etc). |
597 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting, | 577 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting, |
598 ExecutingScriptsMap, | 578 ExecutingScriptsMap, |
599 int32 /* page_id of the _topmost_ frame */, | 579 int32 /* page_id of the _topmost_ frame */, |
600 GURL /* url of the _topmost_ frame */) | 580 GURL /* url of the _topmost_ frame */) |
601 | 581 |
602 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_DidGetApplicationInfo, | |
603 int32 /* page_id */, | |
604 WebApplicationInfo) | |
605 | |
606 // Sent by the renderer to implement chrome.webstore.install(). | 582 // Sent by the renderer to implement chrome.webstore.install(). |
607 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_InlineWebstoreInstall, | 583 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_InlineWebstoreInstall, |
608 int32 /* install id */, | 584 int32 /* install id */, |
609 int32 /* return route id */, | 585 int32 /* return route id */, |
610 std::string /* Web Store item ID */, | 586 std::string /* Web Store item ID */, |
611 GURL /* requestor URL */) | 587 GURL /* requestor URL */) |
612 | 588 |
613 // Sent by the renderer when a web page is checking if its app is installed. | 589 // Sent by the renderer when a web page is checking if its app is installed. |
614 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState, | 590 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState, |
615 GURL /* requestor_url */, | 591 GURL /* requestor_url */, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // certain conditions. This message is sent in response to several events: | 645 // certain conditions. This message is sent in response to several events: |
670 // | 646 // |
671 // * ExtensionMsg_WatchPages was received, updating the set of conditions. | 647 // * ExtensionMsg_WatchPages was received, updating the set of conditions. |
672 // * A new page is loaded. This will be sent after | 648 // * A new page is loaded. This will be sent after |
673 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the | 649 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the |
674 // main frame. | 650 // main frame. |
675 // * Something changed on an existing frame causing the set of matching searches | 651 // * Something changed on an existing frame causing the set of matching searches |
676 // to change. | 652 // to change. |
677 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange, | 653 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange, |
678 std::vector<std::string> /* Matching CSS selectors */) | 654 std::vector<std::string> /* Matching CSS selectors */) |
OLD | NEW |