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

Unified Diff: ios/chrome/browser/notification_promo.cc

Issue 2911033002: Remove raw base::DictionaryValue::Set (Closed)
Patch Set: Proper Windows Fix Created 3 years, 6 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 | « ios/chrome/browser/autofill/autofill_agent.mm ('k') | ios/chrome/browser/notification_promo_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/notification_promo.cc
diff --git a/ios/chrome/browser/notification_promo.cc b/ios/chrome/browser/notification_promo.cc
index 65c132d32030ebbf791b75428d6de7d8e7b7fa34..fd81c3cd633a6da0db036aa62631e1286e415c6f 100644
--- a/ios/chrome/browser/notification_promo.cc
+++ b/ios/chrome/browser/notification_promo.cc
@@ -6,6 +6,9 @@
#include <stddef.h>
+#include <utility>
+
+#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
@@ -76,7 +79,7 @@ void NotificationPromo::InitFromVariations() {
json_or_payload.SetString(iter->first, iter->second);
}
}
- json.Set("payload", payload.DeepCopy());
+ json.Set("payload", base::MakeUnique<base::Value>(payload));
InitFromJson(json);
}
@@ -139,14 +142,14 @@ void NotificationPromo::WritePrefs(int promo_id,
double first_view_time,
int views,
bool closed) {
- base::DictionaryValue* ntp_promo = new base::DictionaryValue;
+ auto ntp_promo = base::MakeUnique<base::DictionaryValue>();
ntp_promo->SetDouble(kPrefPromoFirstViewTime, first_view_time);
ntp_promo->SetInteger(kPrefPromoViews, views);
ntp_promo->SetBoolean(kPrefPromoClosed, closed);
base::DictionaryValue promo_dict;
promo_dict.MergeDictionary(local_state_->GetDictionary(kPrefPromoObject));
- promo_dict.Set(base::IntToString(promo_id), ntp_promo);
+ promo_dict.Set(base::IntToString(promo_id), std::move(ntp_promo));
local_state_->Set(kPrefPromoObject, promo_dict);
DVLOG(1) << "WritePrefs " << promo_dict;
}
« no previous file with comments | « ios/chrome/browser/autofill/autofill_agent.mm ('k') | ios/chrome/browser/notification_promo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698