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

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

Issue 2123863004: ScreenCapture for Android phase1, part II (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments in components/content_settings/ Created 4 years, 5 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" 4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
5 5
6 #include "base/power_monitor/power_monitor.h" 6 #include "base/power_monitor/power_monitor.h"
7 #include "content/browser/media/webrtc/webrtc_eventlog_host.h" 7 #include "content/browser/media/webrtc/webrtc_eventlog_host.h"
8 #include "content/browser/media/webrtc/webrtc_internals.h" 8 #include "content/browser/media/webrtc/webrtc_internals.h"
9 #include "content/browser/renderer_host/render_process_host_impl.h" 9 #include "content/browser/renderer_host/render_process_host_impl.h"
10 #include "content/common/media/media_stream_options.h"
10 #include "content/common/media/peer_connection_tracker_messages.h" 11 #include "content/common/media/peer_connection_tracker_messages.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 PeerConnectionTrackerHost::PeerConnectionTrackerHost( 15 PeerConnectionTrackerHost::PeerConnectionTrackerHost(
15 int render_process_id, 16 int render_process_id,
16 WebRTCEventLogHost* event_log_host) 17 WebRTCEventLogHost* event_log_host)
17 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), 18 : BrowserMessageFilter(PeerConnectionTrackerMsgStart),
18 render_process_id_(render_process_id), 19 render_process_id_(render_process_id),
20 isScreenCapture_(false),
19 event_log_host_(event_log_host) { 21 event_log_host_(event_log_host) {
20 DCHECK(event_log_host); 22 DCHECK(event_log_host);
21 } 23 }
22 24
23 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { 25 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) {
24 bool handled = true; 26 bool handled = true;
25 27
26 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message) 28 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message)
27 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, 29 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection,
28 OnAddPeerConnection) 30 OnAddPeerConnection)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 bool video, 106 bool video,
105 const std::string& audio_constraints, 107 const std::string& audio_constraints,
106 const std::string& video_constraints) { 108 const std::string& video_constraints) {
107 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_, 109 WebRTCInternals::GetInstance()->OnGetUserMedia(render_process_id_,
108 peer_pid(), 110 peer_pid(),
109 origin, 111 origin,
110 audio, 112 audio,
111 video, 113 video,
112 audio_constraints, 114 audio_constraints,
113 video_constraints); 115 video_constraints);
116 #if defined(OS_ANDROID)
117 isScreenCapture_ =
118 video_constraints.find(kMediaStreamSourceScreen) != std::string::npos;
miu 2016/07/14 22:25:53 This feels fragile. Is the |video_constraints| str
braveyao 2016/07/18 20:46:31 Done. Found a more solid method: parse the blink::
119 #endif
114 } 120 }
115 121
116 void PeerConnectionTrackerHost::OnSuspend() { 122 void PeerConnectionTrackerHost::OnSuspend() {
117 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 123 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
118 base::Bind(&PeerConnectionTrackerHost::SendOnSuspendOnUIThread, this)); 124 base::Bind(&PeerConnectionTrackerHost::SendOnSuspendOnUIThread, this));
119 } 125 }
120 126
121 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { 127 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() {
122 DCHECK_CURRENTLY_ON(BrowserThread::UI); 128 DCHECK_CURRENTLY_ON(BrowserThread::UI);
123 content::RenderProcessHost* host = 129 content::RenderProcessHost* host =
124 content::RenderProcessHost::FromID(render_process_id_); 130 content::RenderProcessHost::FromID(render_process_id_);
125 if (host) 131 if (host && !isScreenCapture_)
126 host->Send(new PeerConnectionTracker_OnSuspend()); 132 host->Send(new PeerConnectionTracker_OnSuspend());
127 } 133 }
128 134
129 } // namespace content 135 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698