Commit 0ea6c7ff authored by yilkal's avatar yilkal Committed by Commit Bot

Make app time controller enforce web time limit

This Cl corrects an issue where WebTimeLimitEnforcer
is not notified when time limit is reached. This happens
at the beginning of the session.

Bug: 1062012
Change-Id: I7a14e618dbd5b74b5adcaa1c588d64aea088533c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2105619
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Reviewed-by: default avatarAga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751475}
parent 243fbfe9
......@@ -270,6 +270,21 @@ AppTimeController::AppTimeController(Profile* profile)
// Record enagement metrics.
base::UmaHistogramCounts1000(kEngagementMetric, apps_with_limit_);
// If chrome is paused at the beginning of the session, notify
// web_time_enforcer directly. This is a workaround for bug in AppService that
// occurs at the beginning of the session. It could be removed when
// AppService successfully calls OnWebTimeLimitReached at the beginning of
// sessions.
if (app_registry_->IsAppInstalled(GetChromeAppId()) &&
app_registry_->IsAppTimeLimitReached(GetChromeAppId())) {
base::Optional<AppLimit> web_time_limit = app_registry_->GetWebTimeLimit();
DCHECK(web_time_limit);
DCHECK(web_time_limit->daily_limit());
DCHECK(web_time_enforcer_);
web_time_enforcer_->OnWebTimeLimitReached(
web_time_limit->daily_limit().value());
}
}
AppTimeController::~AppTimeController() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment