| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ |
| 6 #define EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> |
| 13 | 14 |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "extensions/common/extension_messages.h" | 17 #include "extensions/common/extension_messages.h" |
| 17 #include "extensions/common/permissions/api_permission.h" | 18 #include "extensions/common/permissions/api_permission.h" |
| 18 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 19 #include "ipc/ipc_message_utils.h" | 20 #include "ipc/ipc_message_utils.h" |
| 20 | 21 |
| 21 namespace extensions { | 22 namespace extensions { |
| 22 | 23 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 141 } |
| 141 } | 142 } |
| 142 return true; | 143 return true; |
| 143 } | 144 } |
| 144 | 145 |
| 145 std::unique_ptr<base::Value> ToValue() const override { | 146 std::unique_ptr<base::Value> ToValue() const override { |
| 146 base::ListValue* list = new base::ListValue(); | 147 base::ListValue* list = new base::ListValue(); |
| 147 typename std::set<PermissionDataType>::const_iterator i; | 148 typename std::set<PermissionDataType>::const_iterator i; |
| 148 for (i = data_set_.begin(); i != data_set_.end(); ++i) { | 149 for (i = data_set_.begin(); i != data_set_.end(); ++i) { |
| 149 std::unique_ptr<base::Value> item_value(i->ToValue()); | 150 std::unique_ptr<base::Value> item_value(i->ToValue()); |
| 150 list->Append(item_value.release()); | 151 list->Append(std::move(item_value)); |
| 151 } | 152 } |
| 152 return std::unique_ptr<base::Value>(list); | 153 return std::unique_ptr<base::Value>(list); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void GetSize(base::PickleSizer* s) const override { | 156 void GetSize(base::PickleSizer* s) const override { |
| 156 IPC::GetParamSize(s, data_set_); | 157 IPC::GetParamSize(s, data_set_); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void Write(base::Pickle* m) const override { IPC::WriteParam(m, data_set_); } | 160 void Write(base::Pickle* m) const override { IPC::WriteParam(m, data_set_); } |
| 160 | 161 |
| 161 bool Read(const base::Pickle* m, base::PickleIterator* iter) override { | 162 bool Read(const base::Pickle* m, base::PickleIterator* iter) override { |
| 162 return IPC::ReadParam(m, iter, &data_set_); | 163 return IPC::ReadParam(m, iter, &data_set_); |
| 163 } | 164 } |
| 164 | 165 |
| 165 void Log(std::string* log) const override { | 166 void Log(std::string* log) const override { |
| 166 IPC::LogParam(data_set_, log); | 167 IPC::LogParam(data_set_, log); |
| 167 } | 168 } |
| 168 | 169 |
| 169 protected: | 170 protected: |
| 170 std::set<PermissionDataType> data_set_; | 171 std::set<PermissionDataType> data_set_; |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 } // namespace extensions | 174 } // namespace extensions |
| 174 | 175 |
| 175 #endif // EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ | 176 #endif // EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ |
| OLD | NEW |