Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2948613002: [AudioStreamMonitor] Adds API to collect frame-level audibility. (Closed)
Patch Set: Correct comments in code Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 3754bebcc1199260ee1c9cc6f5b904c7936652a3..5eacb7078c3a827354967ce4a3e65639c33b6582 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -437,6 +437,7 @@ RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance,
pending_web_ui_type_(WebUI::kNoWebUI),
should_reuse_web_ui_(false),
has_selection_(false),
+ is_audible_(false),
last_navigation_previews_state_(PREVIEWS_UNSPECIFIED),
frame_host_interface_broker_binding_(this),
frame_host_associated_binding_(this),
@@ -995,6 +996,9 @@ void RenderFrameHostImpl::RenderProcessGone(SiteInstanceImpl* site_instance) {
// Any future UpdateState or UpdateTitle messages from this or a recreated
// process should be ignored until the next commit.
set_nav_entry_id(0);
+
+ if (IsAudible())
nasko 2017/06/21 21:04:07 Why not use is_audible_? It is used directly in ot
lpy 2017/06/21 22:28:18 Done.
+ GetProcess()->OnAudioStreamRemoved();
}
void RenderFrameHostImpl::ReportContentSecurityPolicyViolation(
@@ -3566,6 +3570,20 @@ bool RenderFrameHostImpl::HasSelection() {
return has_selection_;
}
+bool RenderFrameHostImpl::IsAudible() {
+ return is_audible_;
+}
+
+void RenderFrameHostImpl::OnAudioStateChanged(bool is_audible) {
+ if (is_audible != is_audible_) {
+ if (is_audible)
+ GetProcess()->OnAudioStreamAdded();
+ else
+ GetProcess()->OnAudioStreamRemoved();
+ }
+ is_audible_ = is_audible;
+}
+
void RenderFrameHostImpl::GetInterfaceProvider(
service_manager::mojom::InterfaceProviderRequest interfaces) {
service_manager::Identity child_identity = GetProcess()->GetChildIdentity();

Powered by Google App Engine
This is Rietveld 408576698