diff options
Diffstat (limited to 'extensions/common')
| -rw-r--r-- | extensions/common/extension_messages.cc | 24 | ||||
| -rw-r--r-- | extensions/common/extension_messages.h | 16 | ||||
| -rw-r--r-- | extensions/common/host_id.h | 2 |
3 files changed, 38 insertions, 4 deletions
diff --git a/extensions/common/extension_messages.cc b/extensions/common/extension_messages.cc index 94a6bd0..41b8023 100644 --- a/extensions/common/extension_messages.cc +++ b/extensions/common/extension_messages.cc @@ -249,6 +249,30 @@ void ParamTraits<ManifestPermissionSet>::Log( LogParam(p.map(), l); } +void ParamTraits<HostID>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.type()); + WriteParam(m, p.id()); +} + +bool ParamTraits<HostID>::Read( + const Message* m, PickleIterator* iter, param_type* r) { + HostID::HostType type; + std::string id; + if (!ReadParam(m, iter, &type)) + return false; + if (!ReadParam(m, iter, &id)) + return false; + *r = HostID(type, id); + return true; +} + +void ParamTraits<HostID>::Log( + const param_type& p, std::string* l) { + LogParam(p.type(), l); + LogParam(p.id(), l); +} + void ParamTraits<ExtensionMsg_PermissionSetStruct>::Write(Message* m, const param_type& p) { WriteParam(m, p.apis); diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index aee505c..232167c 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h @@ -16,6 +16,7 @@ #include "extensions/common/draggable_region.h" #include "extensions/common/extension.h" #include "extensions/common/extensions_client.h" +#include "extensions/common/host_id.h" #include "extensions/common/permissions/media_galleries_permission_data.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/socket_permission_data.h" @@ -38,6 +39,8 @@ IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType, IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType, extensions::UserScript::INJECTION_TYPE_LAST) +IPC_ENUM_TRAITS_MAX_VALUE(HostID::HostType, HostID::HOST_TYPE_LAST) + // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and // ExtensionHostMsg_AddEventToActivityLog. IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params) @@ -106,9 +109,8 @@ IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params) // The extension API request id, for responding. IPC_STRUCT_MEMBER(int, request_id) - // The ID of the requesting extension. To know which isolated world to - // execute the code inside of. - IPC_STRUCT_MEMBER(std::string, extension_id) + // The ID of the requesting injection host. + IPC_STRUCT_MEMBER(HostID, host_id) // Whether the code is JavaScript or CSS. IPC_STRUCT_MEMBER(bool, is_javascript) @@ -338,6 +340,14 @@ struct ParamTraits<extensions::ManifestPermissionSet> { }; template <> +struct ParamTraits<HostID> { + typedef HostID 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); diff --git a/extensions/common/host_id.h b/extensions/common/host_id.h index d977a44..176ea49 100644 --- a/extensions/common/host_id.h +++ b/extensions/common/host_id.h @@ -10,7 +10,7 @@ // IDs of hosts who own user scripts. // A HostID is immutable after creation. struct HostID { - enum HostType { EXTENSIONS, WEBUI }; + enum HostType { EXTENSIONS, WEBUI, HOST_TYPE_LAST = WEBUI }; HostID(); HostID(HostType type, const std::string& id); |
