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