OLD | NEW |
---|---|
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 |
OLD | NEW |