| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/login/screens/screen_context.h" | 5 #include "components/login/screens/screen_context.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" |
| 10 | 12 |
| 11 namespace login { | 13 namespace login { |
| 12 | 14 |
| 13 namespace { | 15 namespace { |
| 14 | 16 |
| 15 template <typename StringListType> | 17 template <typename StringListType> |
| 16 base::ListValue* StringListToListValue(const StringListType& list) { | 18 base::ListValue* StringListToListValue(const StringListType& list) { |
| 17 base::ListValue* result = new base::ListValue(); | 19 base::ListValue* result = new base::ListValue(); |
| 18 for (typename StringListType::const_iterator it = list.begin(); | 20 for (typename StringListType::const_iterator it = list.begin(); |
| 19 it != list.end(); | 21 it != list.end(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 DCHECK(value); | 172 DCHECK(value); |
| 171 std::unique_ptr<base::Value> new_value(value); | 173 std::unique_ptr<base::Value> new_value(value); |
| 172 | 174 |
| 173 base::Value* current_value; | 175 base::Value* current_value; |
| 174 bool in_storage = storage_.Get(key, ¤t_value); | 176 bool in_storage = storage_.Get(key, ¤t_value); |
| 175 | 177 |
| 176 // Don't do anything if |storage_| already contains <|key|, |new_value|> pair. | 178 // Don't do anything if |storage_| already contains <|key|, |new_value|> pair. |
| 177 if (in_storage && new_value->Equals(current_value)) | 179 if (in_storage && new_value->Equals(current_value)) |
| 178 return false; | 180 return false; |
| 179 | 181 |
| 180 changes_.Set(key, new_value->DeepCopy()); | 182 changes_.Set(key, base::MakeUnique<base::Value>(*new_value)); |
| 181 storage_.Set(key, new_value.release()); | 183 storage_.Set(key, std::move(new_value)); |
| 182 return true; | 184 return true; |
| 183 } | 185 } |
| 184 | 186 |
| 185 } // namespace login | 187 } // namespace login |
| OLD | NEW |