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

Unified Diff: chromeos/dbus/fake_shill_profile_client.cc

Issue 2871653002: Remove raw base::DictionaryValue::SetWithoutPathExpansion in //chromeos (Closed)
Patch Set: Minor Fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/fake_shill_manager_client.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_shill_profile_client.cc
diff --git a/chromeos/dbus/fake_shill_profile_client.cc b/chromeos/dbus/fake_shill_profile_client.cc
index 5ae0145453f82866fcce6e7cedb2b3c861746adf..2b066988bf25c7c31af6adfbb3782af8308f5eb0 100644
--- a/chromeos/dbus/fake_shill_profile_client.cc
+++ b/chromeos/dbus/fake_shill_profile_client.cc
@@ -4,6 +4,8 @@
#include "chromeos/dbus/fake_shill_profile_client.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
@@ -62,15 +64,17 @@ void FakeShillProfileClient::GetProperties(
if (!profile)
return;
- std::unique_ptr<base::DictionaryValue> properties(
- profile->properties.DeepCopy());
- base::ListValue* entry_paths = new base::ListValue;
- properties->SetWithoutPathExpansion(shill::kEntriesProperty, entry_paths);
+ auto entry_paths = base::MakeUnique<base::ListValue>();
for (base::DictionaryValue::Iterator it(profile->entries); !it.IsAtEnd();
it.Advance()) {
entry_paths->AppendString(it.key());
}
+ auto properties =
+ base::MakeUnique<base::DictionaryValue>(profile->properties);
+ properties->SetWithoutPathExpansion(shill::kEntriesProperty,
+ std::move(entry_paths));
+
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&PassDictionary, callback, base::Owned(properties.release())));
@@ -149,7 +153,8 @@ void FakeShillProfileClient::AddEntry(const std::string& profile_path,
ProfileProperties* profile = GetProfile(dbus::ObjectPath(profile_path),
ErrorCallback());
DCHECK(profile);
- profile->entries.SetWithoutPathExpansion(entry_path, properties.DeepCopy());
+ profile->entries.SetWithoutPathExpansion(
+ entry_path, base::MakeUnique<base::Value>(properties));
DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
AddManagerService(entry_path, true);
}
@@ -211,8 +216,8 @@ bool FakeShillProfileClient::AddOrUpdateServiceImpl(
return false;
}
- profile->entries.SetWithoutPathExpansion(service_path,
- service_properties->DeepCopy());
+ profile->entries.SetWithoutPathExpansion(
+ service_path, base::MakeUnique<base::Value>(*service_properties));
return true;
}
« no previous file with comments | « chromeos/dbus/fake_shill_manager_client.cc ('k') | chromeos/dbus/fake_shill_service_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698