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

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

Issue 2181833003: Defer effects of HandleViewed/HandleClosed until prefs are loaded again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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/notification_promo.h ('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 87adf3ac21de32ca46ebfbb67c39a8ab801dc972..e5364adadffabac55754b902d7ff888834077b61 100644
--- a/ios/chrome/browser/notification_promo.cc
+++ b/ios/chrome/browser/notification_promo.cc
@@ -232,18 +232,17 @@ bool NotificationPromo::CanShow() const {
void NotificationPromo::HandleClosed() {
if (!closed_) {
- closed_ = true;
- WritePrefs();
+ WritePrefs(promo_id_, first_view_time_, views_, true);
}
}
-bool NotificationPromo::HandleViewed() {
- ++views_;
- if (first_view_time_ == 0) {
- first_view_time_ = base::Time::Now().ToDoubleT();
+void NotificationPromo::HandleViewed() {
+ int views = views_ + 1;
+ double first_view_time = first_view_time_;
+ if (first_view_time == 0) {
+ first_view_time = base::Time::Now().ToDoubleT();
}
- WritePrefs();
- return ExceedsMaxViews() || ExceedsMaxSeconds();
+ WritePrefs(promo_id_, first_view_time, views, closed_);
}
bool NotificationPromo::ExceedsMaxViews() const {
« no previous file with comments | « ios/chrome/browser/notification_promo.h ('k') | ios/chrome/browser/notification_promo_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698