blob: 541de6371daae0605181aa5fa75f602af1bea2de (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
#include "chrome/browser/media/media_stream_capture_indicator.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
namespace chrome {
bool ShouldShowProjectingIndicator(content::WebContents* contents) {
int render_process_id = contents->GetRenderProcessHost()->GetID();
int render_view_id = contents->GetRenderViewHost()->GetRoutingID();
scoped_refptr<MediaStreamCaptureIndicator> indicator =
MediaCaptureDevicesDispatcher::GetInstance()->
GetMediaStreamCaptureIndicator();
return indicator->IsBeingMirrored(render_process_id, render_view_id);
}
bool ShouldShowRecordingIndicator(content::WebContents* contents) {
int render_process_id = contents->GetRenderProcessHost()->GetID();
int render_view_id = contents->GetRenderViewHost()->GetRoutingID();
scoped_refptr<MediaStreamCaptureIndicator> indicator =
MediaCaptureDevicesDispatcher::GetInstance()->
GetMediaStreamCaptureIndicator();
// The projecting indicator takes precedence over the recording indicator, but
// if we are projecting and we don't handle the projecting case we want to
// still show the recording indicator.
return indicator->IsCapturingUserMedia(render_process_id, render_view_id) ||
indicator->IsBeingMirrored(render_process_id, render_view_id);
}
} // namespace chrome
|