Index: chrome/browser/ui/ash/chrome_launcher_prefs.cc |
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.cc b/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
index 5d60fb7aa3136b1f18c025e3072d3574fc18c01a..598556a08edfc03bb28a7d964f079d06a690f176 100644 |
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.cc |
@@ -6,7 +6,9 @@ |
#include <stddef.h> |
+#include <memory> |
#include <set> |
+#include <utility> |
#include "ash/public/cpp/app_launch_id.h" |
#include "base/macros.h" |
@@ -137,12 +139,13 @@ void SetPerDisplayPref(PrefService* prefs, |
DictionaryPrefUpdate update(prefs, prefs::kShelfPreferences); |
base::DictionaryValue* shelf_prefs = update.Get(); |
- base::DictionaryValue* display_prefs = nullptr; |
- if (!shelf_prefs->GetDictionary(display_key, &display_prefs)) { |
- display_prefs = new base::DictionaryValue(); |
- shelf_prefs->Set(display_key, display_prefs); |
+ base::DictionaryValue* display_prefs_weak = nullptr; |
+ if (!shelf_prefs->GetDictionary(display_key, &display_prefs_weak)) { |
+ auto display_prefs = base::MakeUnique<base::DictionaryValue>(); |
+ display_prefs_weak = display_prefs.get(); |
+ shelf_prefs->Set(display_key, std::move(display_prefs)); |
} |
- display_prefs->SetStringWithoutPathExpansion(pref_key, value); |
+ display_prefs_weak->SetStringWithoutPathExpansion(pref_key, value); |
} |
ShelfAlignment AlignmentFromPref(const std::string& value) { |