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

Side by Side Diff: content/browser/renderer_host/media/media_stream_dispatcher_host.cc

Issue 185863003: [Media] Add user gesture reporting for API calls to midi and media streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test merge Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/media/media_stream_dispatcher_host.h" 5 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
6 6
7 #include "content/browser/browser_main_loop.h" 7 #include "content/browser/browser_main_loop.h"
8 #include "content/browser/child_process_security_policy_impl.h" 8 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/common/media/media_stream_messages.h" 9 #include "content/common/media/media_stream_messages.h"
10 #include "content/common/media/media_stream_options.h" 10 #include "content/common/media/media_stream_options.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 media_stream_manager_->CancelAllRequests(render_process_id_); 120 media_stream_manager_->CancelAllRequests(render_process_id_);
121 } 121 }
122 122
123 MediaStreamDispatcherHost::~MediaStreamDispatcherHost() { 123 MediaStreamDispatcherHost::~MediaStreamDispatcherHost() {
124 } 124 }
125 125
126 void MediaStreamDispatcherHost::OnGenerateStream( 126 void MediaStreamDispatcherHost::OnGenerateStream(
127 int render_view_id, 127 int render_view_id,
128 int page_request_id, 128 int page_request_id,
129 const StreamOptions& components, 129 const StreamOptions& components,
130 const GURL& security_origin) { 130 const GURL& security_origin,
131 bool user_gesture) {
131 DVLOG(1) << "MediaStreamDispatcherHost::OnGenerateStream(" 132 DVLOG(1) << "MediaStreamDispatcherHost::OnGenerateStream("
132 << render_view_id << ", " 133 << render_view_id << ", "
133 << page_request_id << ", [" 134 << page_request_id << ", ["
134 << " audio:" << components.audio_requested 135 << " audio:" << components.audio_requested
135 << " video:" << components.video_requested 136 << " video:" << components.video_requested
136 << " ], " 137 << " ], "
137 << security_origin.spec() << ")"; 138 << security_origin.spec()
139 << ", " << user_gesture << ")";
138 140
139 if (!IsURLAllowed(security_origin)) 141 if (!IsURLAllowed(security_origin))
140 return; 142 return;
141 143
142 media_stream_manager_->GenerateStream( 144 media_stream_manager_->GenerateStream(
143 this, render_process_id_, render_view_id, salt_callback_, 145 this, render_process_id_, render_view_id, salt_callback_,
144 page_request_id, components, security_origin); 146 page_request_id, components, security_origin, user_gesture);
145 } 147 }
146 148
147 void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_view_id, 149 void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_view_id,
148 int page_request_id) { 150 int page_request_id) {
149 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelGenerateStream(" 151 DVLOG(1) << "MediaStreamDispatcherHost::OnCancelGenerateStream("
150 << render_view_id << ", " 152 << render_view_id << ", "
151 << page_request_id << ")"; 153 << page_request_id << ")";
152 media_stream_manager_->CancelRequest(render_process_id_, render_view_id, 154 media_stream_manager_->CancelRequest(render_process_id_, render_view_id,
153 page_request_id); 155 page_request_id);
154 } 156 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( 229 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
228 render_process_id_, url)) { 230 render_process_id_, url)) {
229 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use."; 231 LOG(ERROR) << "MSDH: Renderer requested a URL it's not allowed to use.";
230 return false; 232 return false;
231 } 233 }
232 234
233 return true; 235 return true;
234 } 236 }
235 237
236 } // namespace content 238 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698