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/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/extensions/extension_permission_set.h" | 11 #include "chrome/common/extensions/permissions/permission_set.h" |
12 #include "chrome/common/extensions/url_pattern.h" | 12 #include "chrome/common/extensions/url_pattern.h" |
13 #include "chrome/common/extensions/url_pattern_set.h" | 13 #include "chrome/common/extensions/url_pattern_set.h" |
14 #include "chrome/common/view_type.h" | 14 #include "chrome/common/view_type.h" |
15 #include "chrome/common/web_apps.h" | 15 #include "chrome/common/web_apps.h" |
16 #include "content/public/common/common_param_traits.h" | 16 #include "content/public/common/common_param_traits.h" |
17 #include "ipc/ipc_message_macros.h" | 17 #include "ipc/ipc_message_macros.h" |
18 | 18 |
| 19 using extensions::APIPermission; |
| 20 using extensions::APIPermissionSet; |
| 21 |
19 #define IPC_MESSAGE_START ExtensionMsgStart | 22 #define IPC_MESSAGE_START ExtensionMsgStart |
20 | 23 |
21 IPC_ENUM_TRAITS(chrome::ViewType) | 24 IPC_ENUM_TRAITS(chrome::ViewType) |
22 | 25 |
23 // Parameters structure for ExtensionHostMsg_Request. | 26 // Parameters structure for ExtensionHostMsg_Request. |
24 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params) | 27 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params) |
25 // Message name. | 28 // Message name. |
26 IPC_STRUCT_MEMBER(std::string, name) | 29 IPC_STRUCT_MEMBER(std::string, name) |
27 | 30 |
28 // List of message arguments. | 31 // List of message arguments. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 linked_ptr<DictionaryValue> manifest; | 118 linked_ptr<DictionaryValue> manifest; |
116 | 119 |
117 // The location the extension was installed from. | 120 // The location the extension was installed from. |
118 extensions::Extension::Location location; | 121 extensions::Extension::Location location; |
119 | 122 |
120 // The path the extension was loaded from. This is used in the renderer only | 123 // The path the extension was loaded from. This is used in the renderer only |
121 // to generate the extension ID for extensions that are loaded unpacked. | 124 // to generate the extension ID for extensions that are loaded unpacked. |
122 FilePath path; | 125 FilePath path; |
123 | 126 |
124 // The extension's active permissions. | 127 // The extension's active permissions. |
125 ExtensionAPIPermissionSet apis; | 128 APIPermissionSet apis; |
126 URLPatternSet explicit_hosts; | 129 URLPatternSet explicit_hosts; |
127 URLPatternSet scriptable_hosts; | 130 URLPatternSet scriptable_hosts; |
128 | 131 |
129 // We keep this separate so that it can be used in logging. | 132 // We keep this separate so that it can be used in logging. |
130 std::string id; | 133 std::string id; |
131 | 134 |
132 // Send creation flags so extension is initialized identically. | 135 // Send creation flags so extension is initialized identically. |
133 int creation_flags; | 136 int creation_flags; |
134 }; | 137 }; |
135 | 138 |
136 namespace IPC { | 139 namespace IPC { |
137 | 140 |
138 template <> | 141 template <> |
139 struct ParamTraits<URLPattern> { | 142 struct ParamTraits<URLPattern> { |
140 typedef URLPattern param_type; | 143 typedef URLPattern param_type; |
141 static void Write(Message* m, const param_type& p); | 144 static void Write(Message* m, const param_type& p); |
142 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 145 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
143 static void Log(const param_type& p, std::string* l); | 146 static void Log(const param_type& p, std::string* l); |
144 }; | 147 }; |
145 | 148 |
146 template <> | 149 template <> |
147 struct ParamTraits<URLPatternSet> { | 150 struct ParamTraits<URLPatternSet> { |
148 typedef URLPatternSet param_type; | 151 typedef URLPatternSet param_type; |
149 static void Write(Message* m, const param_type& p); | 152 static void Write(Message* m, const param_type& p); |
150 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 153 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
151 static void Log(const param_type& p, std::string* l); | 154 static void Log(const param_type& p, std::string* l); |
152 }; | 155 }; |
153 | 156 |
154 template <> | 157 template <> |
155 struct ParamTraits<ExtensionAPIPermission::ID> { | 158 struct ParamTraits<APIPermission::ID> { |
156 typedef ExtensionAPIPermission::ID param_type; | 159 typedef APIPermission::ID param_type; |
157 static void Write(Message* m, const param_type& p); | 160 static void Write(Message* m, const param_type& p); |
158 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 161 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
159 static void Log(const param_type& p, std::string* l); | 162 static void Log(const param_type& p, std::string* l); |
160 }; | 163 }; |
161 | 164 |
162 template <> | 165 template <> |
163 struct ParamTraits<ExtensionMsg_Loaded_Params> { | 166 struct ParamTraits<ExtensionMsg_Loaded_Params> { |
164 typedef ExtensionMsg_Loaded_Params param_type; | 167 typedef ExtensionMsg_Loaded_Params param_type; |
165 static void Write(Message* m, const param_type& p); | 168 static void Write(Message* m, const param_type& p); |
166 static bool Read(const Message* m, PickleIterator* iter, param_type* p); | 169 static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 int /* id of browser window */) | 243 int /* id of browser window */) |
241 | 244 |
242 // Tell the render view what its tab ID is. | 245 // Tell the render view what its tab ID is. |
243 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, | 246 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, |
244 int /* id of tab */) | 247 int /* id of tab */) |
245 | 248 |
246 // Tell the renderer to update an extension's permission set. | 249 // Tell the renderer to update an extension's permission set. |
247 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions, | 250 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions, |
248 int /* UpdateExtensionPermissionsInfo::REASON */, | 251 int /* UpdateExtensionPermissionsInfo::REASON */, |
249 std::string /* extension_id */, | 252 std::string /* extension_id */, |
250 ExtensionAPIPermissionSet /* permissions */, | 253 APIPermissionSet /* permissions */, |
251 URLPatternSet /* explicit_hosts */, | 254 URLPatternSet /* explicit_hosts */, |
252 URLPatternSet /* scriptable_hosts */) | 255 URLPatternSet /* scriptable_hosts */) |
253 | 256 |
254 // Tell the renderer about new tab-specific permissions for an extension. | 257 // Tell the renderer about new tab-specific permissions for an extension. |
255 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions, | 258 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions, |
256 int32 /* page_id (only relevant for the target tab) */, | 259 int32 /* page_id (only relevant for the target tab) */, |
257 int /* tab_id */, | 260 int /* tab_id */, |
258 std::string /* extension_id */, | 261 std::string /* extension_id */, |
259 URLPatternSet /* host */) | 262 URLPatternSet /* host */) |
260 | 263 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 // alive. | 478 // alive. |
476 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount) | 479 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount) |
477 | 480 |
478 // Fetches a globally unique ID (for the lifetime of the browser) from the | 481 // Fetches a globally unique ID (for the lifetime of the browser) from the |
479 // browser process. | 482 // browser process. |
480 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID, | 483 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID, |
481 int /* unique_id */) | 484 int /* unique_id */) |
482 | 485 |
483 // Resumes resource requests for a newly created app window. | 486 // Resumes resource requests for a newly created app window. |
484 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */) | 487 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */) |
OLD | NEW |