Chromium Code Reviews| Index: extensions/common/extension_messages.h |
| diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h |
| index 25dfa4dff664f0c9a7584ded1fbbcf060928a163..5241f6524fc734d2a7001138162b5d9ef1dc5eeb 100644 |
| --- a/extensions/common/extension_messages.h |
| +++ b/extensions/common/extension_messages.h |
| @@ -13,6 +13,7 @@ |
| #include "content/public/common/common_param_traits.h" |
| #include "content/public/common/socket_permission_request.h" |
| #include "extensions/common/api/messaging/message.h" |
| +#include "extensions/common/constants.h" |
| #include "extensions/common/draggable_region.h" |
| #include "extensions/common/extension.h" |
| #include "extensions/common/extensions_client.h" |
| @@ -33,6 +34,9 @@ IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType, extensions::VIEW_TYPE_LAST) |
| IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType, |
| content::SocketPermissionRequest::OPERATION_TYPE_LAST) |
| +IPC_ENUM_TRAITS_MAX_VALUE(extension_misc::InjectedScriptType, |
| + extension_misc::PROGRAMMATIC_SCRIPT) |
|
not at google - send to devlin
2014/06/27 23:24:34
define a constant like INJECTED_SCRIPT_LAST as PRO
Devlin
2014/06/30 17:06:10
Done.
|
| + |
| // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and |
| // ExtensionHostMsg_AddEventToActivityLog. |
| IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params) |
| @@ -156,16 +160,6 @@ IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo) |
| IPC_STRUCT_MEMBER(GURL, source_url) |
| IPC_STRUCT_END() |
| -// Parameters structure for ExtensionMsg_UpdatePermissions. |
| -IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params) |
| - IPC_STRUCT_MEMBER(int /* UpdateExtensionPermissionsInfo::REASON */, reason_id) |
| - IPC_STRUCT_MEMBER(std::string, extension_id) |
| - IPC_STRUCT_MEMBER(extensions::APIPermissionSet, apis) |
| - IPC_STRUCT_MEMBER(extensions::ManifestPermissionSet, manifest_permissions) |
| - IPC_STRUCT_MEMBER(extensions::URLPatternSet, explicit_hosts) |
| - IPC_STRUCT_MEMBER(extensions::URLPatternSet, scriptable_hosts) |
| -IPC_STRUCT_END() |
| - |
| IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion) |
| IPC_STRUCT_TRAITS_MEMBER(draggable) |
| IPC_STRUCT_TRAITS_MEMBER(bounds) |
| @@ -212,6 +206,20 @@ typedef std::map<std::string, std::string> SubstitutionMap; |
| // Map of extensions IDs to the executing script paths. |
| typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; |
| +struct ExtensionMsg_PermissionSetStruct { |
|
not at google - send to devlin
2014/06/27 23:24:33
can you instead implement IPC serialization for Pe
Devlin
2014/06/30 17:06:10
Yeah, it is. But we can't do it on PermissionSet
not at google - send to devlin
2014/07/01 00:28:35
ok... why does that mean you can't implement IPCs
not at google - send to devlin
2014/07/01 02:56:50
my comment might have been nonsensical; what does
Devlin
2014/07/01 16:27:05
Sorry, I should have said that PermissionSets are
not at google - send to devlin
2014/07/01 17:02:11
I still don't really follow why this implies you n
Devlin
2014/07/01 18:34:08
Resolved offline; we'll keep the IPC struct until
|
| + ExtensionMsg_PermissionSetStruct(); |
| + explicit ExtensionMsg_PermissionSetStruct( |
| + const extensions::PermissionSet* permissions); |
| + ~ExtensionMsg_PermissionSetStruct(); |
| + |
| + scoped_refptr<const extensions::PermissionSet> ToPermissionSet() const; |
| + |
| + extensions::APIPermissionSet apis; |
| + extensions::ManifestPermissionSet manifest_permissions; |
| + extensions::URLPatternSet explicit_hosts; |
| + extensions::URLPatternSet scriptable_hosts; |
| +}; |
| + |
| struct ExtensionMsg_Loaded_Params { |
| ExtensionMsg_Loaded_Params(); |
| ~ExtensionMsg_Loaded_Params(); |
| @@ -231,11 +239,9 @@ struct ExtensionMsg_Loaded_Params { |
| // to generate the extension ID for extensions that are loaded unpacked. |
| base::FilePath path; |
| - // The extension's active permissions. |
| - extensions::APIPermissionSet apis; |
| - extensions::ManifestPermissionSet manifest_permissions; |
| - extensions::URLPatternSet explicit_hosts; |
| - extensions::URLPatternSet scriptable_hosts; |
| + // The extension's active and withheld permissions. |
| + ExtensionMsg_PermissionSetStruct active_permissions; |
| + ExtensionMsg_PermissionSetStruct withheld_permissions; |
| // We keep this separate so that it can be used in logging. |
| std::string id; |
| @@ -287,6 +293,22 @@ struct ParamTraits<extensions::ManifestPermissionSet> { |
| }; |
| template <> |
| +struct ParamTraits<extensions::PermissionSet> { |
| + typedef extensions::PermissionSet param_type; |
| + static void Write(Message* m, const param_type& p); |
| + static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| + static void Log(const param_type& p, std::string* l); |
| +}; |
| + |
| +template <> |
| +struct ParamTraits<ExtensionMsg_PermissionSetStruct> { |
| + typedef ExtensionMsg_PermissionSetStruct param_type; |
| + static void Write(Message* m, const param_type& p); |
| + static bool Read(const Message* m, PickleIterator* iter, param_type* p); |
| + static void Log(const param_type& p, std::string* l); |
| +}; |
| + |
| +template <> |
| struct ParamTraits<ExtensionMsg_Loaded_Params> { |
| typedef ExtensionMsg_Loaded_Params param_type; |
| static void Write(Message* m, const param_type& p); |
| @@ -298,6 +320,13 @@ struct ParamTraits<ExtensionMsg_Loaded_Params> { |
| #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ |
| +// Parameters structure for ExtensionMsg_UpdatePermissions. |
| +IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params) |
| +IPC_STRUCT_MEMBER(std::string, extension_id) |
| +IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, active_permissions) |
| +IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, withheld_permissions) |
| +IPC_STRUCT_END() |
| + |
| // Messages sent from the browser to the renderer. |
| // The browser sends this message in response to all extension api calls. The |
| @@ -587,8 +616,9 @@ IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting, |
| // If request id is -1, this signals that the request has already ran, and this |
| // merely serves as a notification. This happens when the feature to disable |
| // scripts running without user consent is not enabled. |
| -IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission, |
| +IPC_MESSAGE_ROUTED4(ExtensionHostMsg_RequestScriptInjectionPermission, |
| std::string /* extension id */, |
| + extension_misc::InjectedScriptType /* script type */, |
| int /* page id */, |
| int /* request id */) |