diff options
Diffstat (limited to 'extensions/common')
9 files changed, 67 insertions, 54 deletions
diff --git a/extensions/common/extension_messages.cc b/extensions/common/extension_messages.cc index 15bc121..5cccc11 100644 --- a/extensions/common/extension_messages.cc +++ b/extensions/common/extension_messages.cc @@ -92,11 +92,11 @@ namespace IPC { template <> struct ParamTraits<Manifest::Location> { typedef Manifest::Location param_type; - static void Write(Message* m, const param_type& p) { + static void Write(base::Pickle* m, const param_type& p) { int val = static_cast<int>(p); WriteParam(m, val); } - static bool Read(const Message* m, + static bool Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { int val = 0; @@ -112,12 +112,12 @@ struct ParamTraits<Manifest::Location> { } }; -void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { +void ParamTraits<URLPattern>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.valid_schemes()); WriteParam(m, p.GetAsString()); } -bool ParamTraits<URLPattern>::Read(const Message* m, +bool ParamTraits<URLPattern>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { int valid_schemes; @@ -141,11 +141,11 @@ void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { LogParam(p.GetAsString(), l); } -void ParamTraits<URLPatternSet>::Write(Message* m, const param_type& p) { +void ParamTraits<URLPatternSet>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.patterns()); } -bool ParamTraits<URLPatternSet>::Read(const Message* m, +bool ParamTraits<URLPatternSet>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { std::set<URLPattern> patterns; @@ -162,12 +162,12 @@ void ParamTraits<URLPatternSet>::Log(const param_type& p, std::string* l) { LogParam(p.patterns(), l); } -void ParamTraits<APIPermission::ID>::Write( - Message* m, const param_type& p) { +void ParamTraits<APIPermission::ID>::Write(base::Pickle* m, + const param_type& p) { WriteParam(m, static_cast<int>(p)); } -bool ParamTraits<APIPermission::ID>::Read(const Message* m, +bool ParamTraits<APIPermission::ID>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { int api_id = -2; @@ -183,8 +183,8 @@ void ParamTraits<APIPermission::ID>::Log( LogParam(static_cast<int>(p), l); } -void ParamTraits<APIPermissionSet>::Write( - Message* m, const param_type& p) { +void ParamTraits<APIPermissionSet>::Write(base::Pickle* m, + const param_type& p) { APIPermissionSet::const_iterator it = p.begin(); const APIPermissionSet::const_iterator end = p.end(); WriteParam(m, p.size()); @@ -194,7 +194,7 @@ void ParamTraits<APIPermissionSet>::Write( } } -bool ParamTraits<APIPermissionSet>::Read(const Message* m, +bool ParamTraits<APIPermissionSet>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { size_t size; @@ -221,8 +221,8 @@ void ParamTraits<APIPermissionSet>::Log( LogParam(p.map(), l); } -void ParamTraits<ManifestPermissionSet>::Write( - Message* m, const param_type& p) { +void ParamTraits<ManifestPermissionSet>::Write(base::Pickle* m, + const param_type& p) { ManifestPermissionSet::const_iterator it = p.begin(); const ManifestPermissionSet::const_iterator end = p.end(); WriteParam(m, p.size()); @@ -232,7 +232,7 @@ void ParamTraits<ManifestPermissionSet>::Write( } } -bool ParamTraits<ManifestPermissionSet>::Read(const Message* m, +bool ParamTraits<ManifestPermissionSet>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { size_t size; @@ -257,13 +257,12 @@ void ParamTraits<ManifestPermissionSet>::Log( LogParam(p.map(), l); } -void ParamTraits<HostID>::Write( - Message* m, const param_type& p) { +void ParamTraits<HostID>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.type()); WriteParam(m, p.id()); } -bool ParamTraits<HostID>::Read(const Message* m, +bool ParamTraits<HostID>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { HostID::HostType type; @@ -282,7 +281,7 @@ void ParamTraits<HostID>::Log( LogParam(p.id(), l); } -void ParamTraits<ExtensionMsg_PermissionSetStruct>::Write(Message* m, +void ParamTraits<ExtensionMsg_PermissionSetStruct>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.apis); WriteParam(m, p.manifest_permissions); @@ -291,7 +290,7 @@ void ParamTraits<ExtensionMsg_PermissionSetStruct>::Write(Message* m, } bool ParamTraits<ExtensionMsg_PermissionSetStruct>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* p) { return ReadParam(m, iter, &p->apis) && @@ -308,7 +307,7 @@ void ParamTraits<ExtensionMsg_PermissionSetStruct>::Log(const param_type& p, LogParam(p.scriptable_hosts, l); } -void ParamTraits<ExtensionMsg_Loaded_Params>::Write(Message* m, +void ParamTraits<ExtensionMsg_Loaded_Params>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.location); WriteParam(m, p.path); @@ -318,7 +317,7 @@ void ParamTraits<ExtensionMsg_Loaded_Params>::Write(Message* m, WriteParam(m, p.withheld_permissions); } -bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const Message* m, +bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { p->manifest.reset(new base::DictionaryValue()); diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index 2e025ac..5125941 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h @@ -304,64 +304,80 @@ namespace IPC { template <> struct ParamTraits<URLPattern> { typedef URLPattern param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<extensions::URLPatternSet> { typedef extensions::URLPatternSet param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<extensions::APIPermission::ID> { typedef extensions::APIPermission::ID param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<extensions::APIPermissionSet> { typedef extensions::APIPermissionSet param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<extensions::ManifestPermissionSet> { typedef extensions::ManifestPermissionSet param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct ParamTraits<HostID> { typedef HostID param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::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, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::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); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; diff --git a/extensions/common/permissions/api_permission.cc b/extensions/common/permissions/api_permission.cc index 89eaea5..77a1317 100644 --- a/extensions/common/permissions/api_permission.cc +++ b/extensions/common/permissions/api_permission.cc @@ -69,9 +69,9 @@ class SimpleAPIPermission : public APIPermission { return new SimpleAPIPermission(info()); } - void Write(IPC::Message* m) const override {} + void Write(base::Pickle* m) const override {} - bool Read(const IPC::Message* m, base::PickleIterator* iter) override { + bool Read(const base::Pickle* m, base::PickleIterator* iter) override { return true; } diff --git a/extensions/common/permissions/api_permission.h b/extensions/common/permissions/api_permission.h index 5d46ce9..0b6f1a3 100644 --- a/extensions/common/permissions/api_permission.h +++ b/extensions/common/permissions/api_permission.h @@ -324,10 +324,10 @@ class APIPermission { // IPC functions // Writes this into the given IPC message |m|. - virtual void Write(IPC::Message* m) const = 0; + virtual void Write(base::Pickle* m) const = 0; // Reads from the given IPC message |m|. - virtual bool Read(const IPC::Message* m, base::PickleIterator* iter) = 0; + virtual bool Read(const base::Pickle* m, base::PickleIterator* iter) = 0; // Logs this permission. virtual void Log(std::string* log) const = 0; diff --git a/extensions/common/permissions/manifest_permission.cc b/extensions/common/permissions/manifest_permission.cc index a3ba98e..9742138 100644 --- a/extensions/common/permissions/manifest_permission.cc +++ b/extensions/common/permissions/manifest_permission.cc @@ -27,14 +27,14 @@ bool ManifestPermission::Equal(const ManifestPermission* rhs) const { return ToValue()->Equals(rhs->ToValue().get()); } -void ManifestPermission::Write(IPC::Message* m) const { +void ManifestPermission::Write(base::Pickle* m) const { base::ListValue singleton; base::Value* value = ToValue().release(); singleton.Append(value); IPC::WriteParam(m, singleton); } -bool ManifestPermission::Read(const IPC::Message* m, +bool ManifestPermission::Read(const base::Pickle* m, base::PickleIterator* iter) { base::ListValue singleton; if (!IPC::ReadParam(m, iter, &singleton)) diff --git a/extensions/common/permissions/manifest_permission.h b/extensions/common/permissions/manifest_permission.h index 67c41d5..db8f07c 100644 --- a/extensions/common/permissions/manifest_permission.h +++ b/extensions/common/permissions/manifest_permission.h @@ -69,10 +69,10 @@ class ManifestPermission { // IPC functions // Writes this into the given IPC message |m|. - void Write(IPC::Message* m) const; + void Write(base::Pickle* m) const; // Reads from the given IPC message |m|. - bool Read(const IPC::Message* m, base::PickleIterator* iter); + bool Read(const base::Pickle* m, base::PickleIterator* iter); // Logs this permission. void Log(std::string* log) const; diff --git a/extensions/common/permissions/set_disjunction_permission.h b/extensions/common/permissions/set_disjunction_permission.h index 1e124ab..0e97e9d 100644 --- a/extensions/common/permissions/set_disjunction_permission.h +++ b/extensions/common/permissions/set_disjunction_permission.h @@ -147,11 +147,9 @@ class SetDisjunctionPermission : public APIPermission { return scoped_ptr<base::Value>(list); } - void Write(IPC::Message* m) const override { - IPC::WriteParam(m, data_set_); - } + void Write(base::Pickle* m) const override { IPC::WriteParam(m, data_set_); } - bool Read(const IPC::Message* m, base::PickleIterator* iter) override { + bool Read(const base::Pickle* m, base::PickleIterator* iter) override { return IPC::ReadParam(m, iter, &data_set_); } diff --git a/extensions/common/permissions/settings_override_permission.cc b/extensions/common/permissions/settings_override_permission.cc index 7756c5e..43765d2 100644 --- a/extensions/common/permissions/settings_override_permission.cc +++ b/extensions/common/permissions/settings_override_permission.cc @@ -84,9 +84,9 @@ APIPermission* SettingsOverrideAPIPermission::Intersect( return new SettingsOverrideAPIPermission(info(), setting_value_); } -void SettingsOverrideAPIPermission::Write(IPC::Message* m) const {} +void SettingsOverrideAPIPermission::Write(base::Pickle* m) const {} -bool SettingsOverrideAPIPermission::Read(const IPC::Message* m, +bool SettingsOverrideAPIPermission::Read(const base::Pickle* m, base::PickleIterator* iter) { return true; } diff --git a/extensions/common/permissions/settings_override_permission.h b/extensions/common/permissions/settings_override_permission.h index 32dc8b3..81a2730 100644 --- a/extensions/common/permissions/settings_override_permission.h +++ b/extensions/common/permissions/settings_override_permission.h @@ -33,8 +33,8 @@ class SettingsOverrideAPIPermission : public APIPermission { APIPermission* Diff(const APIPermission* rhs) const override; APIPermission* Union(const APIPermission* rhs) const override; APIPermission* Intersect(const APIPermission* rhs) const override; - void Write(IPC::Message* m) const override; - bool Read(const IPC::Message* m, base::PickleIterator* iter) override; + void Write(base::Pickle* m) const override; + bool Read(const base::Pickle* m, base::PickleIterator* iter) override; void Log(std::string* log) const override; private: |