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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2948613002: [AudioStreamMonitor] Adds API to collect frame-level audibility. (Closed)
Patch Set: Removed public API, fixed tests 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 pending_commit_(false), 430 pending_commit_(false),
431 nav_entry_id_(0), 431 nav_entry_id_(0),
432 accessibility_reset_token_(0), 432 accessibility_reset_token_(0),
433 accessibility_reset_count_(0), 433 accessibility_reset_count_(0),
434 browser_plugin_embedder_ax_tree_id_(ui::AXTreeIDRegistry::kNoAXTreeID), 434 browser_plugin_embedder_ax_tree_id_(ui::AXTreeIDRegistry::kNoAXTreeID),
435 no_create_browser_accessibility_manager_for_testing_(false), 435 no_create_browser_accessibility_manager_for_testing_(false),
436 web_ui_type_(WebUI::kNoWebUI), 436 web_ui_type_(WebUI::kNoWebUI),
437 pending_web_ui_type_(WebUI::kNoWebUI), 437 pending_web_ui_type_(WebUI::kNoWebUI),
438 should_reuse_web_ui_(false), 438 should_reuse_web_ui_(false),
439 has_selection_(false), 439 has_selection_(false),
440 is_audible_(false),
440 last_navigation_previews_state_(PREVIEWS_UNSPECIFIED), 441 last_navigation_previews_state_(PREVIEWS_UNSPECIFIED),
441 frame_host_interface_broker_binding_(this), 442 frame_host_interface_broker_binding_(this),
442 frame_host_associated_binding_(this), 443 frame_host_associated_binding_(this),
443 waiting_for_init_(renderer_initiated_creation), 444 waiting_for_init_(renderer_initiated_creation),
444 has_focused_editable_element_(false), 445 has_focused_editable_element_(false),
445 weak_ptr_factory_(this) { 446 weak_ptr_factory_(this) {
446 frame_tree_->AddRenderViewHostRef(render_view_host_); 447 frame_tree_->AddRenderViewHostRef(render_view_host_);
447 GetProcess()->AddRoute(routing_id_, this); 448 GetProcess()->AddRoute(routing_id_, this);
448 g_routing_id_frame_map.Get().insert(std::make_pair( 449 g_routing_id_frame_map.Get().insert(std::make_pair(
449 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 450 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 ResetLoadingState(); 989 ResetLoadingState();
989 990
990 // The renderer process is gone, so the |stream_handle_| will no longer be 991 // The renderer process is gone, so the |stream_handle_| will no longer be
991 // used. It can be released. 992 // used. It can be released.
992 // TODO(clamy): Remove this when we switch to Mojo streams. 993 // TODO(clamy): Remove this when we switch to Mojo streams.
993 stream_handle_.reset(); 994 stream_handle_.reset();
994 995
995 // Any future UpdateState or UpdateTitle messages from this or a recreated 996 // Any future UpdateState or UpdateTitle messages from this or a recreated
996 // process should be ignored until the next commit. 997 // process should be ignored until the next commit.
997 set_nav_entry_id(0); 998 set_nav_entry_id(0);
999
1000 if (is_audible_)
1001 GetProcess()->OnAudioStreamRemoved();
998 } 1002 }
999 1003
1000 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation( 1004 void RenderFrameHostImpl::ReportContentSecurityPolicyViolation(
1001 const CSPViolationParams& violation_params) { 1005 const CSPViolationParams& violation_params) {
1002 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_, 1006 Send(new FrameMsg_ReportContentSecurityPolicyViolation(routing_id_,
1003 violation_params)); 1007 violation_params));
1004 } 1008 }
1005 1009
1006 void RenderFrameHostImpl::SanitizeDataForUseInCspViolation( 1010 void RenderFrameHostImpl::SanitizeDataForUseInCspViolation(
1007 bool is_redirect, 1011 bool is_redirect,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1179
1176 waiting_for_init_ = false; 1180 waiting_for_init_ = false;
1177 if (pendinging_navigate_) { 1181 if (pendinging_navigate_) {
1178 frame_tree_node()->navigator()->OnBeginNavigation( 1182 frame_tree_node()->navigator()->OnBeginNavigation(
1179 frame_tree_node(), pendinging_navigate_->first, 1183 frame_tree_node(), pendinging_navigate_->first,
1180 pendinging_navigate_->second); 1184 pendinging_navigate_->second);
1181 pendinging_navigate_.reset(); 1185 pendinging_navigate_.reset();
1182 } 1186 }
1183 } 1187 }
1184 1188
1189 bool RenderFrameHostImpl::IsAudible() {
1190 return is_audible_;
1191 }
1192
1193 void RenderFrameHostImpl::OnAudioStateChanged(bool is_audible) {
1194 if (is_audible != is_audible_) {
DaleCurtis 2017/06/22 00:35:54 early return is preferred.
lpy 2017/06/22 02:28:52 Done.
1195 if (is_audible)
1196 GetProcess()->OnAudioStreamAdded();
1197 else
1198 GetProcess()->OnAudioStreamRemoved();
1199 }
1200 is_audible_ = is_audible;
1201 }
1202
1185 void RenderFrameHostImpl::OnDidAddMessageToConsole( 1203 void RenderFrameHostImpl::OnDidAddMessageToConsole(
1186 int32_t level, 1204 int32_t level,
1187 const base::string16& message, 1205 const base::string16& message,
1188 int32_t line_no, 1206 int32_t line_no,
1189 const base::string16& source_id) { 1207 const base::string16& source_id) {
1190 if (level < logging::LOG_VERBOSE || level > logging::LOG_FATAL) { 1208 if (level < logging::LOG_VERBOSE || level > logging::LOG_FATAL) {
1191 bad_message::ReceivedBadMessage( 1209 bad_message::ReceivedBadMessage(
1192 GetProcess(), bad_message::RFH_DID_ADD_CONSOLE_MESSAGE_BAD_SEVERITY); 1210 GetProcess(), bad_message::RFH_DID_ADD_CONSOLE_MESSAGE_BAD_SEVERITY);
1193 return; 1211 return;
1194 } 1212 }
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 } 4137 }
4120 4138
4121 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 4139 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
4122 const std::string& interface_name, 4140 const std::string& interface_name,
4123 mojo::ScopedMessagePipeHandle pipe) { 4141 mojo::ScopedMessagePipeHandle pipe) {
4124 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 4142 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
4125 } 4143 }
4126 #endif 4144 #endif
4127 4145
4128 } // namespace content 4146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698