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

Unified Diff: chromeos/dbus/fake_shill_manager_client.cc

Issue 2336863003: Change more base::ListValue methods to use std::unique_ptr. (Closed)
Patch Set: . Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_shill_manager_client.cc
diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc
index 17a0487b0fbfd6565c41e8fa73fefe25a766316d..047c4f1ac10b0f93815e437ae287e68c0cbcad24 100644
--- a/chromeos/dbus/fake_shill_manager_client.cc
+++ b/chromeos/dbus/fake_shill_manager_client.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/location.h"
+#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
@@ -382,7 +383,8 @@ ShillManagerClient::TestInterface* FakeShillManagerClient::GetTestInterface() {
void FakeShillManagerClient::AddDevice(const std::string& device_path) {
if (GetListProperty(shill::kDevicesProperty)
- ->AppendIfNotPresent(new base::StringValue(device_path))) {
+ ->AppendIfNotPresent(
+ base::MakeUnique<base::StringValue>(device_path))) {
CallNotifyObserversPropertyChanged(shill::kDevicesProperty);
}
}
@@ -403,13 +405,13 @@ void FakeShillManagerClient::ClearDevices() {
void FakeShillManagerClient::AddTechnology(const std::string& type,
bool enabled) {
if (GetListProperty(shill::kAvailableTechnologiesProperty)
- ->AppendIfNotPresent(new base::StringValue(type))) {
+ ->AppendIfNotPresent(base::MakeUnique<base::StringValue>(type))) {
CallNotifyObserversPropertyChanged(
shill::kAvailableTechnologiesProperty);
}
if (enabled &&
GetListProperty(shill::kEnabledTechnologiesProperty)
- ->AppendIfNotPresent(new base::StringValue(type))) {
+ ->AppendIfNotPresent(base::MakeUnique<base::StringValue>(type))) {
CallNotifyObserversPropertyChanged(
shill::kEnabledTechnologiesProperty);
}
@@ -433,7 +435,7 @@ void FakeShillManagerClient::SetTechnologyInitializing(const std::string& type,
bool initializing) {
if (initializing) {
if (GetListProperty(shill::kUninitializedTechnologiesProperty)
- ->AppendIfNotPresent(new base::StringValue(type))) {
+ ->AppendIfNotPresent(base::MakeUnique<base::StringValue>(type))) {
CallNotifyObserversPropertyChanged(
shill::kUninitializedTechnologiesProperty);
}
@@ -460,8 +462,8 @@ void FakeShillManagerClient::AddGeoNetwork(
void FakeShillManagerClient::AddProfile(const std::string& profile_path) {
const char* key = shill::kProfilesProperty;
- if (GetListProperty(key)
- ->AppendIfNotPresent(new base::StringValue(profile_path))) {
+ if (GetListProperty(key)->AppendIfNotPresent(
+ base::MakeUnique<base::StringValue>(profile_path))) {
CallNotifyObserversPropertyChanged(key);
}
}
@@ -481,7 +483,7 @@ void FakeShillManagerClient::AddManagerService(
bool notify_observers) {
VLOG(2) << "AddManagerService: " << service_path;
GetListProperty(shill::kServiceCompleteListProperty)
- ->AppendIfNotPresent(new base::StringValue(service_path));
+ ->AppendIfNotPresent(base::MakeUnique<base::StringValue>(service_path));
SortManagerServices(false);
if (notify_observers)
CallNotifyObserversPropertyChanged(shill::kServiceCompleteListProperty);
@@ -1008,7 +1010,7 @@ void FakeShillManagerClient::SetTechnologyEnabled(
base::ListValue* enabled_list =
GetListProperty(shill::kEnabledTechnologiesProperty);
if (enabled)
- enabled_list->AppendIfNotPresent(new base::StringValue(type));
+ enabled_list->AppendIfNotPresent(base::MakeUnique<base::StringValue>(type));
else
enabled_list->Remove(base::StringValue(type), NULL);
CallNotifyObserversPropertyChanged(

Powered by Google App Engine
This is Rietveld 408576698