Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: extensions/common/permissions/manifest_permission.cc

Issue 408493002: Make Clone, Contains, Equal and IPC function non-virtual and implement in manifest_permission.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src@warnings
Patch Set: Rebase to master Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698