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

Unified Diff: chrome/browser/ui/ash/chrome_launcher_prefs.cc

Issue 2812953002: Stop passing raw pointers to base::Value API in c/b/ui (Closed)
Patch Set: No ListValue::SetDouble Created 3 years, 8 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: 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) {

Powered by Google App Engine
This is Rietveld 408576698