OLD | NEW |
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 "chrome/browser/ui/tabs/tab_utils.h" | 5 #include "chrome/browser/ui/tabs/tab_utils.h" |
6 | 6 |
7 #include "chrome/browser/media/audio_stream_indicator.h" | 7 #include "chrome/browser/media/audio_stream_indicator.h" |
8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 8 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
9 #include "chrome/browser/media/media_stream_capture_indicator.h" | 9 #include "chrome/browser/media/media_stream_capture_indicator.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
13 | 13 |
14 namespace chrome { | 14 namespace chrome { |
15 | 15 |
16 bool ShouldShowProjectingIndicator(content::WebContents* contents) { | 16 bool ShouldShowProjectingIndicator(content::WebContents* contents) { |
17 int render_process_id = contents->GetRenderProcessHost()->GetID(); | |
18 int render_view_id = contents->GetRenderViewHost()->GetRoutingID(); | |
19 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 17 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
20 MediaCaptureDevicesDispatcher::GetInstance()-> | 18 MediaCaptureDevicesDispatcher::GetInstance()-> |
21 GetMediaStreamCaptureIndicator(); | 19 GetMediaStreamCaptureIndicator(); |
22 return indicator->IsBeingMirrored(render_process_id, render_view_id); | 20 return indicator->IsBeingMirrored(contents); |
23 } | 21 } |
24 | 22 |
25 bool ShouldShowRecordingIndicator(content::WebContents* contents) { | 23 bool ShouldShowRecordingIndicator(content::WebContents* contents) { |
26 int render_process_id = contents->GetRenderProcessHost()->GetID(); | |
27 int render_view_id = contents->GetRenderViewHost()->GetRoutingID(); | |
28 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 24 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
29 MediaCaptureDevicesDispatcher::GetInstance()-> | 25 MediaCaptureDevicesDispatcher::GetInstance()-> |
30 GetMediaStreamCaptureIndicator(); | 26 GetMediaStreamCaptureIndicator(); |
31 // The projecting indicator takes precedence over the recording indicator, but | 27 // The projecting indicator takes precedence over the recording indicator, but |
32 // if we are projecting and we don't handle the projecting case we want to | 28 // if we are projecting and we don't handle the projecting case we want to |
33 // still show the recording indicator. | 29 // still show the recording indicator. |
34 return indicator->IsCapturingUserMedia(render_process_id, render_view_id) || | 30 return indicator->IsCapturingUserMedia(contents) || |
35 indicator->IsBeingMirrored(render_process_id, render_view_id); | 31 indicator->IsBeingMirrored(contents); |
36 } | 32 } |
37 | 33 |
38 bool IsPlayingAudio(content::WebContents* contents) { | 34 bool IsPlayingAudio(content::WebContents* contents) { |
39 AudioStreamIndicator* audio_indicator = | 35 AudioStreamIndicator* audio_indicator = |
40 MediaCaptureDevicesDispatcher::GetInstance()->GetAudioStreamIndicator(); | 36 MediaCaptureDevicesDispatcher::GetInstance()->GetAudioStreamIndicator(); |
41 return audio_indicator->IsPlayingAudio(contents); | 37 return audio_indicator->IsPlayingAudio(contents); |
42 } | 38 } |
43 | 39 |
44 } // namespace chrome | 40 } // namespace chrome |
OLD | NEW |