summaryrefslogtreecommitdiffstats
path: root/chrome/browser/web_resource
diff options
context:
space:
mode:
authoraruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 02:20:52 +0000
committeraruslan@chromium.org <aruslan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-08 02:20:52 +0000
commit198c94d0b7d274110c1055f91152e37c88a14979 (patch)
treeafe9f5e8fb9628cf4ea7ba3750e99d823bf06b41 /chrome/browser/web_resource
parent1a6d3fe0b53deb7cc3a7725ff221803671d0c12a (diff)
downloadchromium_src-198c94d0b7d274110c1055f91152e37c88a14979.zip
chromium_src-198c94d0b7d274110c1055f91152e37c88a14979.tar.gz
chromium_src-198c94d0b7d274110c1055f91152e37c88a14979.tar.bz2
Immediate notification if active promotion arrives
If an active (begin<now<end) promotion arrives after the initial launch sequence, the promo resource service will notify clients immediately AND schedule a notification at the end of promotion. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10541054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_resource')
-rw-r--r--chrome/browser/web_resource/promo_resource_service.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/chrome/browser/web_resource/promo_resource_service.cc b/chrome/browser/web_resource/promo_resource_service.cc
index fbdeab1..a1113a1 100644
--- a/chrome/browser/web_resource/promo_resource_service.cc
+++ b/chrome/browser/web_resource/promo_resource_service.cc
@@ -150,14 +150,16 @@ void PromoResourceService::ScheduleNotification(double promo_start,
int64 ms_until_end =
static_cast<int64>((base::Time::FromDoubleT(
promo_end) - base::Time::Now()).InMilliseconds());
- if (ms_until_start > 0)
+ if (ms_until_start > 0) {
+ // Schedule the next notification to happen at the start of promotion.
PostNotification(ms_until_start);
- if (ms_until_end > 0) {
- PostNotification(ms_until_end);
+ } else if (ms_until_end > 0) {
if (ms_until_start <= 0) {
// Notify immediately if time is between start and end.
PostNotification(0);
}
+ // Schedule the next notification to happen at the end of promotion.
+ PostNotification(ms_until_end);
}
}
}