Commit 5571101d authored by Chris Hamilton's avatar Chris Hamilton Committed by Commit Bot

Handle missing RecentlyAudibleHelper in cr/br/ui/tab_utils.

These helpers are intended for use with WebContents hosted in tabs, but are
occasionally used outside of that context. This simple fix stops the helper
from exploding in that case.

BUG=849796

Change-Id: I85caef9cd397eec5fd77b8ad16bdcc9d6f3adbbd
Reviewed-on: https://chromium-review.googlesource.com/1089294Reviewed-by: default avatarJohn Abd-El-Malek <jam@chromium.org>
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565332}
parent 34bf2246
......@@ -181,8 +181,14 @@ TabAlertState GetTabAlertStateForContents(content::WebContents* contents) {
if (contents->HasPictureInPictureVideo())
return TabAlertState::PIP_PLAYING;
// Only tabs have a RecentlyAudibleHelper, but this function is abused for
// some non-tab WebContents. In that case fall back to using the realtime
// notion of audibility.
bool audible = contents->IsCurrentlyAudible();
auto* audible_helper = RecentlyAudibleHelper::FromWebContents(contents);
if (audible_helper->WasRecentlyAudible()) {
if (audible_helper)
audible = audible_helper->WasRecentlyAudible();
if (audible) {
if (contents->IsAudioMuted())
return TabAlertState::AUDIO_MUTING;
return TabAlertState::AUDIO_PLAYING;
......
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