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 "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/extensions/draggable_region.h" | 10 #include "chrome/common/extensions/draggable_region.h" |
11 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
12 #include "chrome/common/extensions/permissions/permission_set.h" | 12 #include "chrome/common/extensions/permissions/permission_set.h" |
13 #include "chrome/common/extensions/permissions/socket_permission_data.h" | 13 #include "chrome/common/extensions/permissions/socket_permission_data.h" |
14 #include "chrome/common/extensions/url_pattern_set.h" | |
15 #include "chrome/common/view_type.h" | 14 #include "chrome/common/view_type.h" |
16 #include "chrome/common/web_apps.h" | 15 #include "chrome/common/web_apps.h" |
17 #include "content/public/common/common_param_traits.h" | 16 #include "content/public/common/common_param_traits.h" |
18 #include "extensions/common/url_pattern.h" | 17 #include "extensions/common/url_pattern.h" |
| 18 #include "extensions/common/url_pattern_set.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
21 | 21 |
22 #define IPC_MESSAGE_START ExtensionMsgStart | 22 #define IPC_MESSAGE_START ExtensionMsgStart |
23 | 23 |
24 IPC_ENUM_TRAITS(chrome::ViewType) | 24 IPC_ENUM_TRAITS(chrome::ViewType) |
25 | 25 |
26 // Parameters structure for ExtensionHostMsg_Request. | 26 // Parameters structure for ExtensionHostMsg_Request. |
27 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params) | 27 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params) |
28 // Message name. | 28 // Message name. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 // The location the extension was installed from. | 129 // The location the extension was installed from. |
130 extensions::Extension::Location location; | 130 extensions::Extension::Location location; |
131 | 131 |
132 // The path the extension was loaded from. This is used in the renderer only | 132 // The path the extension was loaded from. This is used in the renderer only |
133 // to generate the extension ID for extensions that are loaded unpacked. | 133 // to generate the extension ID for extensions that are loaded unpacked. |
134 FilePath path; | 134 FilePath path; |
135 | 135 |
136 // The extension's active permissions. | 136 // The extension's active permissions. |
137 extensions::APIPermissionSet apis; | 137 extensions::APIPermissionSet apis; |
138 URLPatternSet explicit_hosts; | 138 extensions::URLPatternSet explicit_hosts; |
139 URLPatternSet scriptable_hosts; | 139 extensions::URLPatternSet scriptable_hosts; |
140 | 140 |
141 // We keep this separate so that it can be used in logging. | 141 // We keep this separate so that it can be used in logging. |
142 std::string id; | 142 std::string id; |
143 | 143 |
144 // Send creation flags so extension is initialized identically. | 144 // Send creation flags so extension is initialized identically. |
145 int creation_flags; | 145 int creation_flags; |
146 }; | 146 }; |
147 | 147 |
148 namespace IPC { | 148 namespace IPC { |
149 | 149 |
150 template <> | 150 template <> |
151 struct ParamTraits<URLPattern> { | 151 struct ParamTraits<URLPattern> { |
152 typedef URLPattern param_type; | 152 typedef URLPattern param_type; |
153 static void Write(Message* m, const param_type& p); | 153 static void Write(Message* m, const param_type& p); |
154 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 154 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
155 static void Log(const param_type& p, std::string* l); | 155 static void Log(const param_type& p, std::string* l); |
156 }; | 156 }; |
157 | 157 |
158 template <> | 158 template <> |
159 struct ParamTraits<URLPatternSet> { | 159 struct ParamTraits<extensions::URLPatternSet> { |
160 typedef URLPatternSet param_type; | 160 typedef extensions::URLPatternSet param_type; |
161 static void Write(Message* m, const param_type& p); | 161 static void Write(Message* m, const param_type& p); |
162 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 162 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
163 static void Log(const param_type& p, std::string* l); | 163 static void Log(const param_type& p, std::string* l); |
164 }; | 164 }; |
165 | 165 |
166 template <> | 166 template <> |
167 struct ParamTraits<extensions::APIPermission::ID> { | 167 struct ParamTraits<extensions::APIPermission::ID> { |
168 typedef extensions::APIPermission::ID param_type; | 168 typedef extensions::APIPermission::ID param_type; |
169 static void Write(Message* m, const param_type& p); | 169 static void Write(Message* m, const param_type& p); |
170 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 170 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 // Tell the render view what its tab ID is. | 276 // Tell the render view what its tab ID is. |
277 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, | 277 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, |
278 int /* id of tab */) | 278 int /* id of tab */) |
279 | 279 |
280 // Tell the renderer to update an extension's permission set. | 280 // Tell the renderer to update an extension's permission set. |
281 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions, | 281 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions, |
282 int /* UpdateExtensionPermissionsInfo::REASON */, | 282 int /* UpdateExtensionPermissionsInfo::REASON */, |
283 std::string /* extension_id */, | 283 std::string /* extension_id */, |
284 extensions::APIPermissionSet /* permissions */, | 284 extensions::APIPermissionSet /* permissions */, |
285 URLPatternSet /* explicit_hosts */, | 285 extensions::URLPatternSet /* explicit_hosts */, |
286 URLPatternSet /* scriptable_hosts */) | 286 extensions::URLPatternSet /* scriptable_hosts */) |
287 | 287 |
288 // Tell the renderer about new tab-specific permissions for an extension. | 288 // Tell the renderer about new tab-specific permissions for an extension. |
289 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions, | 289 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions, |
290 int32 /* page_id (only relevant for the target tab) */, | 290 int32 /* page_id (only relevant for the target tab) */, |
291 int /* tab_id */, | 291 int /* tab_id */, |
292 std::string /* extension_id */, | 292 std::string /* extension_id */, |
293 URLPatternSet /* hosts */) | 293 extensions::URLPatternSet /* hosts */) |
294 | 294 |
295 // Tell the renderer to clear tab-specific permissions for some extensions. | 295 // Tell the renderer to clear tab-specific permissions for some extensions. |
296 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions, | 296 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions, |
297 int /* tab_id */, | 297 int /* tab_id */, |
298 std::vector<std::string> /* extension_ids */) | 298 std::vector<std::string> /* extension_ids */) |
299 | 299 |
300 // Tell the renderer which type this view is. | 300 // Tell the renderer which type this view is. |
301 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType, | 301 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType, |
302 chrome::ViewType /* view_type */) | 302 chrome::ViewType /* view_type */) |
303 | 303 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 // browser process. | 547 // browser process. |
548 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID, | 548 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID, |
549 int /* unique_id */) | 549 int /* unique_id */) |
550 | 550 |
551 // Resumes resource requests for a newly created app window. | 551 // Resumes resource requests for a newly created app window. |
552 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */) | 552 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */) |
553 | 553 |
554 // Sent by the renderer when the draggable regions are updated. | 554 // Sent by the renderer when the draggable regions are updated. |
555 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions, | 555 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions, |
556 std::vector<extensions::DraggableRegion> /* regions */) | 556 std::vector<extensions::DraggableRegion> /* regions */) |
OLD | NEW |