Audio notification plumbed from guest WebContents up to embedder.
When a guest webcontents is playing audio, there is no way for an
entity interacting with the embedder webcontents to determine this.
This CL adds two things:
i) The ability for WebContentsImpl::WasRecentlyAudible() to query any
guest/child contents to determine if they were recently audible, and
ii) the ability for a guest webcontents to pass any navigation state
changes up to the embedder in order to make them visible at the top
level.
BUG=590656
Review-Url: https://codereview.chromium.org/1970313002
Cr-Commit-Position: refs/heads/master@{#393689}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 7e12a8c..e44ae4f 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1290,6 +1290,9 @@
if (delegate_)
delegate_->NavigationStateChanged(this, changed_flags);
+
+ if (GetOuterWebContents())
+ GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags);
}
base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
@@ -3044,7 +3047,9 @@
}
bool WebContentsImpl::WasRecentlyAudible() {
- return audio_stream_monitor_.WasRecentlyAudible();
+ return audio_stream_monitor_.WasRecentlyAudible() ||
+ (browser_plugin_embedder_ &&
+ browser_plugin_embedder_->WereAnyGuestsRecentlyAudible());
}
void WebContentsImpl::GetManifest(const GetManifestCallback& callback) {