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

Side by Side Diff: chrome/browser/chromeos/settings/cros_settings.cc

Issue 2418833003: Remove use of deprecated base::ListValue::Append(Value*) overload in //chrome/browser/chromeos (Closed)
Patch Set: use-after-move 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/settings/cros_settings.h" 5 #include "chrome/browser/chromeos/settings/cros_settings.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 base::StringValue value(in_value); 145 base::StringValue value(in_value);
146 Set(path, value); 146 Set(path, value);
147 } 147 }
148 148
149 void CrosSettings::AppendToList(const std::string& path, 149 void CrosSettings::AppendToList(const std::string& path,
150 const base::Value* value) { 150 const base::Value* value) {
151 DCHECK(CalledOnValidThread()); 151 DCHECK(CalledOnValidThread());
152 const base::Value* old_value = GetPref(path); 152 const base::Value* old_value = GetPref(path);
153 std::unique_ptr<base::Value> new_value(old_value ? old_value->DeepCopy() 153 std::unique_ptr<base::Value> new_value(old_value ? old_value->DeepCopy()
154 : new base::ListValue()); 154 : new base::ListValue());
155 static_cast<base::ListValue*>(new_value.get())->Append(value->DeepCopy()); 155 static_cast<base::ListValue*>(new_value.get())
156 ->Append(value->CreateDeepCopy());
156 Set(path, *new_value); 157 Set(path, *new_value);
157 } 158 }
158 159
159 void CrosSettings::RemoveFromList(const std::string& path, 160 void CrosSettings::RemoveFromList(const std::string& path,
160 const base::Value* value) { 161 const base::Value* value) {
161 DCHECK(CalledOnValidThread()); 162 DCHECK(CalledOnValidThread());
162 const base::Value* old_value = GetPref(path); 163 const base::Value* old_value = GetPref(path);
163 std::unique_ptr<base::Value> new_value(old_value ? old_value->DeepCopy() 164 std::unique_ptr<base::Value> new_value(old_value ? old_value->DeepCopy()
164 : new base::ListValue()); 165 : new base::ListValue());
165 static_cast<base::ListValue*>(new_value.get())->Remove(*value, NULL); 166 static_cast<base::ListValue*>(new_value.get())->Remove(*value, NULL);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 344
344 ScopedTestCrosSettings::ScopedTestCrosSettings() { 345 ScopedTestCrosSettings::ScopedTestCrosSettings() {
345 CrosSettings::Initialize(); 346 CrosSettings::Initialize();
346 } 347 }
347 348
348 ScopedTestCrosSettings::~ScopedTestCrosSettings() { 349 ScopedTestCrosSettings::~ScopedTestCrosSettings() {
349 CrosSettings::Shutdown(); 350 CrosSettings::Shutdown();
350 } 351 }
351 352
352 } // namespace chromeos 353 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698