Chromium Code Reviews| Index: extensions/common/permissions/manifest_permission.cc |
| diff --git a/extensions/common/permissions/manifest_permission.cc b/extensions/common/permissions/manifest_permission.cc |
| index b15c541467da6056ff5d529037f6d47e08eb28e5..f7f4ff95f6d487d4e4c4334afc0d6293d65c404d 100644 |
| --- a/extensions/common/permissions/manifest_permission.cc |
| +++ b/extensions/common/permissions/manifest_permission.cc |
| @@ -2,7 +2,10 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "extensions/common/manifest_handler.h" |
| #include "extensions/common/permissions/manifest_permission.h" |
| +#include "ipc/ipc_message.h" |
| +#include "ipc/ipc_message_utils.h" |
| namespace extensions { |
| @@ -10,4 +13,40 @@ ManifestPermission::ManifestPermission() {} |
| ManifestPermission::~ManifestPermission() { } |
| +ManifestPermission* ManifestPermission::Clone() const { |
| + ManifestPermission* clone = ManifestHandler::CreatePermission(name()); |
| + DCHECK(clone->FromValue(ToValue().get())); |
|
not at google - send to devlin
2014/07/18 17:41:17
make this a CHECK if anything, otherwise FromValue
aboxhall
2014/07/18 21:08:52
Done.
|
| + return clone; |
| +} |
| + |
| +bool ManifestPermission::Contains(const ManifestPermission* rhs) const { |
| + return Intersect(rhs)->Equal(rhs); |
| +} |
| + |
| +void ManifestPermission::Write(IPC::Message* m) const { |
| + base::ListValue singleton; |
| + base::Value* value = ToValue().release(); |
| + singleton.Append(value); |
| + IPC::WriteParam(m, singleton); |
| +} |
| + |
| +bool ManifestPermission::Read(const IPC::Message* m, PickleIterator* iter) { |
| + base::ListValue singleton; |
| + if (!IPC::ReadParam(m, iter, &singleton)) |
| + return false; |
| + if (singleton.GetSize() != 1) |
| + return false; |
| + base::Value* value = NULL; |
| + if (!singleton.Get(0, &value)) |
| + return false; |
| + return FromValue(value); |
| +} |
| + |
| +void ManifestPermission::Log(std::string* log) const { |
| + base::ListValue singleton; |
| + scoped_ptr<base::Value> value(ToValue()); |
| + singleton.Append(value.get()); |
| + IPC::LogParam(singleton, log); |
|
not at google - send to devlin
2014/07/18 17:41:17
see comment in previous CL about using JSONWriter
aboxhall
2014/07/18 21:08:52
Done. (Not using OPTIONS_PRETTY_PRINT though, is t
not at google - send to devlin
2014/07/18 22:02:18
so like I mentioned in the other CL I don't really
aboxhall
2014/07/18 22:38:16
Done.
|
| +} |
| + |
| } // namespace extensions |