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

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

Issue 10704143: Allow max_group = 0 to pass all groups. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
Index: chrome/browser/web_resource/notification_promo.cc
===================================================================
--- chrome/browser/web_resource/notification_promo.cc (revision 145631)
+++ chrome/browser/web_resource/notification_promo.cc (working copy)
@@ -144,11 +144,11 @@
grouping->GetInteger("increment_frequency", &time_slice_);
grouping->GetInteger("increment_max", &max_group_);
- DVLOG(1) << "num_groups_=" << num_groups_;
- DVLOG(1) << "initial_segment_ = " << initial_segment_;
- DVLOG(1) << "increment_ = " << increment_;
- DVLOG(1) << "time_slice_ = " << time_slice_;
- DVLOG(1) << "max_group_ = " << max_group_;
+ DVLOG(1) << "num_groups_ = " << num_groups_
+ << ", initial_segment_ = " << initial_segment_
+ << ", increment_ = " << increment_
+ << ", time_slice_ = " << time_slice_
+ << ", max_group_ = " << max_group_;
}
// Payload.
@@ -283,7 +283,7 @@
bool NotificationPromo::CanShow() const {
return !closed_ &&
!promo_text_.empty() &&
- group_ < max_group_ &&
+ !ExceedsMaxGroup() &&
!ExceedsMaxViews() &&
base::Time::FromDoubleT(StartTimeForGroup()) < base::Time::Now() &&
base::Time::FromDoubleT(EndTime()) > base::Time::Now() &&
@@ -307,6 +307,10 @@
return ExceedsMaxViews();
}
+bool NotificationPromo::ExceedsMaxGroup() const {
+ return (max_group_ == 0) ? false : group_ >= max_group_;
+}
+
bool NotificationPromo::ExceedsMaxViews() const {
return (max_views_ == 0) ? false : views_ >= max_views_;
}
« no previous file with comments | « chrome/browser/web_resource/notification_promo.h ('k') | chrome/browser/web_resource/promo_resource_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698