Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: content/browser/service_manager/merge_dictionary.cc

Issue 2884933002: Remove raw base::DictionaryValue::SetWithoutPathExpansion (Closed)
Patch Set: Include Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/wifi/wifi_service_mac.mm ('k') | dbus/values_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/service_manager/merge_dictionary.h" 5 #include "content/browser/service_manager/merge_dictionary.h"
6 6
7 #include "base/memory/ptr_util.h"
8
7 namespace content { 9 namespace content {
8 10
9 void MergeDictionary(base::DictionaryValue* target, 11 void MergeDictionary(base::DictionaryValue* target,
10 const base::DictionaryValue* source) { 12 const base::DictionaryValue* source) {
11 for (base::DictionaryValue::Iterator it(*source); !it.IsAtEnd(); 13 for (base::DictionaryValue::Iterator it(*source); !it.IsAtEnd();
12 it.Advance()) { 14 it.Advance()) {
13 const base::Value* merge_value = &it.value(); 15 const base::Value* merge_value = &it.value();
14 // Check whether we have to merge dictionaries. 16 // Check whether we have to merge dictionaries.
15 if (merge_value->IsType(base::Value::Type::DICTIONARY)) { 17 if (merge_value->IsType(base::Value::Type::DICTIONARY)) {
16 base::DictionaryValue* sub_dict; 18 base::DictionaryValue* sub_dict;
(...skipping 12 matching lines...) Expand all
29 for (size_t i = 0; i < merge_list->GetSize(); ++i) { 31 for (size_t i = 0; i < merge_list->GetSize(); ++i) {
30 const base::Value* element = nullptr; 32 const base::Value* element = nullptr;
31 CHECK(merge_list->Get(i, &element)); 33 CHECK(merge_list->Get(i, &element));
32 target_list->Append(element->CreateDeepCopy()); 34 target_list->Append(element->CreateDeepCopy());
33 } 35 }
34 continue; 36 continue;
35 } 37 }
36 } 38 }
37 } 39 }
38 // All other cases: Make a copy and hook it up. 40 // All other cases: Make a copy and hook it up.
39 target->SetWithoutPathExpansion(it.key(), merge_value->DeepCopy()); 41 target->SetWithoutPathExpansion(
42 it.key(), base::MakeUnique<base::Value>(*merge_value));
40 } 43 }
41 } 44 }
42 45
43 } // namespace content 46 } // namespace content
OLDNEW
« no previous file with comments | « components/wifi/wifi_service_mac.mm ('k') | dbus/values_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698