| 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> |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 std::unique_ptr<base::Value> ToValue() const override { | 145 std::unique_ptr<base::Value> ToValue() const override { |
| 146 base::ListValue* list = new base::ListValue(); | 146 base::ListValue* list = new base::ListValue(); |
| 147 typename std::set<PermissionDataType>::const_iterator i; | 147 typename std::set<PermissionDataType>::const_iterator i; |
| 148 for (i = data_set_.begin(); i != data_set_.end(); ++i) { | 148 for (i = data_set_.begin(); i != data_set_.end(); ++i) { |
| 149 std::unique_ptr<base::Value> item_value(i->ToValue()); | 149 std::unique_ptr<base::Value> item_value(i->ToValue()); |
| 150 list->Append(item_value.release()); | 150 list->Append(item_value.release()); |
| 151 } | 151 } |
| 152 return std::unique_ptr<base::Value>(list); | 152 return std::unique_ptr<base::Value>(list); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void GetSize(base::PickleSizer* s) const override { |
| 156 IPC::GetParamSize(s, data_set_); |
| 157 } |
| 158 |
| 155 void Write(base::Pickle* m) const override { IPC::WriteParam(m, data_set_); } | 159 void Write(base::Pickle* m) const override { IPC::WriteParam(m, data_set_); } |
| 156 | 160 |
| 157 bool Read(const base::Pickle* m, base::PickleIterator* iter) override { | 161 bool Read(const base::Pickle* m, base::PickleIterator* iter) override { |
| 158 return IPC::ReadParam(m, iter, &data_set_); | 162 return IPC::ReadParam(m, iter, &data_set_); |
| 159 } | 163 } |
| 160 | 164 |
| 161 void Log(std::string* log) const override { | 165 void Log(std::string* log) const override { |
| 162 IPC::LogParam(data_set_, log); | 166 IPC::LogParam(data_set_, log); |
| 163 } | 167 } |
| 164 | 168 |
| 165 protected: | 169 protected: |
| 166 std::set<PermissionDataType> data_set_; | 170 std::set<PermissionDataType> data_set_; |
| 167 }; | 171 }; |
| 168 | 172 |
| 169 } // namespace extensions | 173 } // namespace extensions |
| 170 | 174 |
| 171 #endif // EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ | 175 #endif // EXTENSIONS_COMMON_PERMISSIONS_SET_DISJUNCTION_PERMISSION_H_ |
| OLD | NEW |