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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/common/manifest_handler.h"
5 #include "extensions/common/permissions/manifest_permission.h" 6 #include "extensions/common/permissions/manifest_permission.h"
7 #include "ipc/ipc_message.h"
8 #include "ipc/ipc_message_utils.h"
6 9
7 namespace extensions { 10 namespace extensions {
8 11
9 ManifestPermission::ManifestPermission() {} 12 ManifestPermission::ManifestPermission() {}
10 13
11 ManifestPermission::~ManifestPermission() { } 14 ManifestPermission::~ManifestPermission() { }
12 15
16 ManifestPermission* ManifestPermission::Clone() const {
17 ManifestPermission* clone = ManifestHandler::CreatePermission(name());
18 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.
19 return clone;
20 }
21
22 bool ManifestPermission::Contains(const ManifestPermission* rhs) const {
23 return Intersect(rhs)->Equal(rhs);
24 }
25
26 void ManifestPermission::Write(IPC::Message* m) const {
27 base::ListValue singleton;
28 base::Value* value = ToValue().release();
29 singleton.Append(value);
30 IPC::WriteParam(m, singleton);
31 }
32
33 bool ManifestPermission::Read(const IPC::Message* m, PickleIterator* iter) {
34 base::ListValue singleton;
35 if (!IPC::ReadParam(m, iter, &singleton))
36 return false;
37 if (singleton.GetSize() != 1)
38 return false;
39 base::Value* value = NULL;
40 if (!singleton.Get(0, &value))
41 return false;
42 return FromValue(value);
43 }
44
45 void ManifestPermission::Log(std::string* log) const {
46 base::ListValue singleton;
47 scoped_ptr<base::Value> value(ToValue());
48 singleton.Append(value.get());
49 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.
50 }
51
13 } // namespace extensions 52 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698