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

Side by Side Diff: extensions/browser/value_store/value_store_change.cc

Issue 2370633002: replace deprecated version of SetWithoutPathExpansion (Closed)
Patch Set: use MakeUnique Created 4 years, 2 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
OLDNEW
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 #include "extensions/browser/value_store/value_store_change.h" 5 #include "extensions/browser/value_store/value_store_change.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 12
13 // static 13 // static
14 std::string ValueStoreChange::ToJson( 14 std::string ValueStoreChange::ToJson(
15 const ValueStoreChangeList& changes) { 15 const ValueStoreChangeList& changes) {
16 base::DictionaryValue changes_value; 16 base::DictionaryValue changes_value;
17 for (ValueStoreChangeList::const_iterator it = changes.begin(); 17 for (ValueStoreChangeList::const_iterator it = changes.begin();
18 it != changes.end(); ++it) { 18 it != changes.end(); ++it) {
19 base::DictionaryValue* change_value = new base::DictionaryValue(); 19 std::unique_ptr<base::DictionaryValue> change_value =
20 base::MakeUnique<base::DictionaryValue>();
20 if (it->old_value()) { 21 if (it->old_value()) {
21 change_value->Set("oldValue", it->old_value()->DeepCopy()); 22 change_value->Set("oldValue", it->old_value()->DeepCopy());
22 } 23 }
23 if (it->new_value()) { 24 if (it->new_value()) {
24 change_value->Set("newValue", it->new_value()->DeepCopy()); 25 change_value->Set("newValue", it->new_value()->DeepCopy());
25 } 26 }
26 changes_value.SetWithoutPathExpansion(it->key(), change_value); 27 changes_value.SetWithoutPathExpansion(it->key(), std::move(change_value));
27 } 28 }
28 std::string json; 29 std::string json;
29 bool success = base::JSONWriter::Write(changes_value, &json); 30 bool success = base::JSONWriter::Write(changes_value, &json);
30 DCHECK(success); 31 DCHECK(success);
31 return json; 32 return json;
32 } 33 }
33 34
34 ValueStoreChange::ValueStoreChange(const std::string& key, 35 ValueStoreChange::ValueStoreChange(const std::string& key,
35 std::unique_ptr<base::Value> old_value, 36 std::unique_ptr<base::Value> old_value,
36 std::unique_ptr<base::Value> new_value) 37 std::unique_ptr<base::Value> new_value)
(...skipping 19 matching lines...) Expand all
56 } 57 }
57 58
58 ValueStoreChange::Inner::Inner(const std::string& key, 59 ValueStoreChange::Inner::Inner(const std::string& key,
59 std::unique_ptr<base::Value> old_value, 60 std::unique_ptr<base::Value> old_value,
60 std::unique_ptr<base::Value> new_value) 61 std::unique_ptr<base::Value> new_value)
61 : key_(key), 62 : key_(key),
62 old_value_(std::move(old_value)), 63 old_value_(std::move(old_value)),
63 new_value_(std::move(new_value)) {} 64 new_value_(std::move(new_value)) {}
64 65
65 ValueStoreChange::Inner::~Inner() {} 66 ValueStoreChange::Inner::~Inner() {}
OLDNEW
« no previous file with comments | « extensions/browser/value_store/leveldb_value_store.cc ('k') | extensions/common/value_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698