summaryrefslogtreecommitdiffstats
path: root/extensions/common/permissions
diff options
context:
space:
mode:
authorrockot <rockot@chromium.org>2016-02-03 12:20:16 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-03 20:21:49 +0000
commit502c94ff1a9f99b5c4ecfe700415cc4ed14228dd (patch)
tree260521d2640e580c11a54d24781ef0ebc32baee3 /extensions/common/permissions
parent26c9117edc07280155c69c7fab04729af46a79eb (diff)
downloadchromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.zip
chromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.tar.gz
chromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.tar.bz2
IPC::Message -> base::Pickle
This changes consumers of IPC::Message to generally refer refer to base::Pickle instead when performing serialization and deserialization operations. The few specific instances where the IPC::Message interface (Read/WriteAttachent) is needed can safely be static_cast'd, as IPC::Message is the only public subclass of base::Pickle. The purpose of this change is to facilitate the transition to Mojo IPC, as we've trained the Mojo bindings layer to use existing ParamTraits<T> parameterized over base::Pickle. To support this base::Pickle has had some stub interfaces added for WriteAttachment and ReadAttachment, along with a Pickle::Attachment. A follow-up patch will add sizing traits to the standard IPC_STRUCT macros, enabling the majority of Chrome IPC structs to be carried over Mojo message pipes as-is. BUG=577685 R=jam@chromium.org Review URL: https://codereview.chromium.org/1659003003 Cr-Commit-Position: refs/heads/master@{#373323}
Diffstat (limited to 'extensions/common/permissions')
-rw-r--r--extensions/common/permissions/api_permission.cc4
-rw-r--r--extensions/common/permissions/api_permission.h4
-rw-r--r--extensions/common/permissions/manifest_permission.cc4
-rw-r--r--extensions/common/permissions/manifest_permission.h4
-rw-r--r--extensions/common/permissions/set_disjunction_permission.h6
-rw-r--r--extensions/common/permissions/settings_override_permission.cc4
-rw-r--r--extensions/common/permissions/settings_override_permission.h4
7 files changed, 14 insertions, 16 deletions
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: