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/permissions/manifest_permission.h" | 5 #include "extensions/common/permissions/manifest_permission.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "extensions/common/manifest_handler.h" | 8 #include "extensions/common/manifest_handler.h" |
9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_utils.h" | 10 #include "ipc/ipc_message_utils.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 singleton.Append(value); | 33 singleton.Append(value); |
34 IPC::WriteParam(m, singleton); | 34 IPC::WriteParam(m, singleton); |
35 } | 35 } |
36 | 36 |
37 bool ManifestPermission::Read(const IPC::Message* m, PickleIterator* iter) { | 37 bool ManifestPermission::Read(const IPC::Message* m, PickleIterator* iter) { |
38 base::ListValue singleton; | 38 base::ListValue singleton; |
39 if (!IPC::ReadParam(m, iter, &singleton)) | 39 if (!IPC::ReadParam(m, iter, &singleton)) |
40 return false; | 40 return false; |
41 if (singleton.GetSize() != 1) | 41 if (singleton.GetSize() != 1) |
42 return false; | 42 return false; |
43 base::Value* value = NULL; | 43 base::Value* value = nullptr; |
44 if (!singleton.Get(0, &value)) | 44 if (!singleton.Get(0, &value)) |
45 return false; | 45 return false; |
46 return FromValue(value); | 46 return FromValue(value); |
47 } | 47 } |
48 | 48 |
49 void ManifestPermission::Log(std::string* log) const { | 49 void ManifestPermission::Log(std::string* log) const { |
50 base::JSONWriter::WriteWithOptions( | 50 base::JSONWriter::WriteWithOptions( |
51 ToValue().get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, log); | 51 ToValue().get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, log); |
52 } | 52 } |
53 | 53 |
54 } // namespace extensions | 54 } // namespace extensions |
OLD | NEW |