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

Unified Diff: chrome/browser/ui/zoom/chrome_zoom_level_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
« no previous file with comments | « chrome/browser/ui/webui/voice_search_ui.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
index 65576ae8c34a1564339f73fcabfc979a81b829a7..cde991f9060b060ce9311fe3c7c813d09165e251 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc
@@ -6,7 +6,10 @@
#include <stddef.h>
+#include <memory>
+
#include "base/bind.h"
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
#include "chrome/common/chrome_constants.h"
@@ -109,17 +112,21 @@ void ChromeZoomLevelPrefs::OnZoomLevelChanged(
bool modification_is_removal =
content::ZoomValuesEqual(level, host_zoom_map_->GetDefaultZoomLevel());
- base::DictionaryValue* host_zoom_dictionary = nullptr;
+ base::DictionaryValue* host_zoom_dictionary_weak = nullptr;
if (!host_zoom_dictionaries->GetDictionary(partition_key_,
- &host_zoom_dictionary)) {
- host_zoom_dictionary = new base::DictionaryValue();
- host_zoom_dictionaries->Set(partition_key_, host_zoom_dictionary);
+ &host_zoom_dictionary_weak)) {
+ auto host_zoom_dictionary = base::MakeUnique<base::DictionaryValue>();
+ host_zoom_dictionary_weak = host_zoom_dictionary.get();
+ host_zoom_dictionaries->Set(partition_key_,
+ std::move(host_zoom_dictionary));
}
- if (modification_is_removal)
- host_zoom_dictionary->RemoveWithoutPathExpansion(change.host, nullptr);
- else
- host_zoom_dictionary->SetDoubleWithoutPathExpansion(change.host, level);
+ if (modification_is_removal) {
+ host_zoom_dictionary_weak->RemoveWithoutPathExpansion(change.host, nullptr);
+ } else {
+ host_zoom_dictionary_weak->SetDoubleWithoutPathExpansion(change.host,
+ level);
+ }
}
// TODO(wjmaclean): Remove the dictionary_path once the migration code is
« no previous file with comments | « chrome/browser/ui/webui/voice_search_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698