Commit ef56ceb8 authored by Peter K. Lee's avatar Peter K. Lee Committed by Commit Bot

Interpret UIApplicationState correctly for TabUsageRecorder

UIApplicationState was incorrectly casted into a bool making
UIApplicationStateActive (which has a numerical value of 0) to be
incorrectly interpreted as "not active".

Fixing bug w/o unit test for now. Test will be updated in a
follow up CL.

Bug: 781361
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ia7fd52a5809873777c01981079cde9c3fe5e8008
Reviewed-on: https://chromium-review.googlesource.com/802464Reviewed-by: default avatarGregory Chatzinoff <gchatz@chromium.org>
Commit-Queue: Peter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520797}
parent d61bc8c4
...@@ -451,8 +451,17 @@ void TabUsageRecorder::PageLoaded( ...@@ -451,8 +451,17 @@ void TabUsageRecorder::PageLoaded(
} }
void TabUsageRecorder::RenderProcessGone(web::WebState* web_state) { void TabUsageRecorder::RenderProcessGone(web::WebState* web_state) {
RendererTerminated(web_state, web_state->IsVisible(), bool is_active;
[UIApplication sharedApplication].applicationState); switch ([UIApplication sharedApplication].applicationState) {
case UIApplicationStateActive:
is_active = true;
break;
case UIApplicationStateInactive:
case UIApplicationStateBackground:
is_active = false;
break;
}
RendererTerminated(web_state, web_state->IsVisible(), is_active);
} }
void TabUsageRecorder::WebStateDestroyed(web::WebState* web_state) { void TabUsageRecorder::WebStateDestroyed(web::WebState* web_state) {
......
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