Commit 63ecd699 authored by braveyao's avatar braveyao Committed by Commit Bot

[desktopCapture] Add red recording dot on the caller tab

This cl is to add a red recording dot indicator for the tab that starts
the desktop capture.
This is part of the required UI change for the new getDisplayMaid API.

Bug: 859981
Change-Id: I9e36f6a4c61802152936282ba5f3902db1f774cd
Reviewed-on: https://chromium-review.googlesource.com/1125079
Commit-Queue: Weiyong Yao <braveyao@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573846}
parent cf15d505
......@@ -8568,6 +8568,9 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_TOOLTIP_TAB_ALERT_STATE_PIP_PLAYING" desc="Extra tool tip text, when tab is playing a video in Picture-in-Picture.">
This tab is playing a video in Picture-in-Picture.
</message>
<message name="IDS_TOOLTIP_TAB_ALERT_STATE_DESKTOP_CAPTURING" desc="Extra tool tip text, when the tab is caturing desktop contents.">
This tab is sharing your desktop content.
</message>
<!-- Tab accessibility labels -->
<message name="IDS_TAB_AX_LABEL_MEDIA_RECORDING_FORMAT" desc="Accessibility label text, when the tab is recording media. Example: 'Google Hangouts - Camera or microphone recording'">
......@@ -8597,6 +8600,9 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_TAB_AX_LABEL_CRASHED_FORMAT" desc="Accessibility label text, when a tab has crashed. Example: 'Google Search - Crashed'">
<ph name="WINDOW_TITLE">$1<ex>Google Search</ex></ph> - Crashed
</message>
<message name="IDS_TAB_AX_LABEL_DESKTOP_CAPTURING_FORMAT" desc="Accessibility label text, when the tab is capturing and sharing desktop content using screen sharing. Example: 'Google Hangouts - Desktop content shared'">
<ph name="WINDOW_TITLE">$1<ex>Google Hangouts</ex></ph> - Desktop content shared
</message>
<!-- ProcessSingleton -->
<message name="IDS_PROFILE_IN_USE_LINUX_QUIT" desc="Text of button in profile in use dialog to quit without doing anything.">
......
......@@ -162,6 +162,12 @@ TabAlertState GetTabAlertStateForContents(content::WebContents* contents) {
MediaCaptureDevicesDispatcher::GetInstance()->
GetMediaStreamCaptureIndicator();
if (indicator.get()) {
// Currently we only show the icon and tooltip of the highest-priority
// alert on a tab.
// TODO(crbug.com/861961): To show the icon of the highest-priority alert
// with tooltip that notes all the states in play.
if (indicator->IsCapturingDesktop(contents))
return TabAlertState::DESKTOP_CAPTURING;
if (indicator->IsBeingMirrored(contents))
return TabAlertState::TAB_CAPTURING;
if (indicator->IsCapturingUserMedia(contents))
......@@ -209,6 +215,7 @@ gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state,
: &kTabAudioMutingIcon;
break;
case TabAlertState::MEDIA_RECORDING:
case TabAlertState::DESKTOP_CAPTURING:
icon = &kTabMediaRecordingIcon;
break;
case TabAlertState::TAB_CAPTURING:
......@@ -249,6 +256,7 @@ gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state,
case TabAlertState::BLUETOOTH_CONNECTED:
case TabAlertState::USB_CONNECTED:
case TabAlertState::PIP_PLAYING:
case TabAlertState::DESKTOP_CAPTURING:
return GetTabAlertIndicatorImage(alert_state, button_color);
}
NOTREACHED();
......@@ -258,7 +266,8 @@ gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state,
std::unique_ptr<gfx::Animation> CreateTabAlertIndicatorFadeAnimation(
TabAlertState alert_state) {
if (alert_state == TabAlertState::MEDIA_RECORDING ||
alert_state == TabAlertState::TAB_CAPTURING) {
alert_state == TabAlertState::TAB_CAPTURING ||
alert_state == TabAlertState::DESKTOP_CAPTURING) {
return TabRecordingIndicatorAnimation::Create();
}
......@@ -314,6 +323,10 @@ base::string16 AssembleTabTooltipText(const base::string16& title,
result.append(
l10n_util::GetStringUTF16(IDS_TOOLTIP_TAB_ALERT_STATE_PIP_PLAYING));
break;
case TabAlertState::DESKTOP_CAPTURING:
result.append(l10n_util::GetStringUTF16(
IDS_TOOLTIP_TAB_ALERT_STATE_DESKTOP_CAPTURING));
break;
case TabAlertState::NONE:
NOTREACHED();
break;
......@@ -358,6 +371,10 @@ base::string16 AssembleTabAccessibilityLabel(const base::string16& title,
case TabAlertState::PIP_PLAYING:
return l10n_util::GetStringFUTF16(IDS_TAB_AX_LABEL_PIP_PLAYING_FORMAT,
title);
case TabAlertState::DESKTOP_CAPTURING:
return l10n_util::GetStringFUTF16(
IDS_TAB_AX_LABEL_DESKTOP_CAPTURING_FORMAT, title);
case TabAlertState::NONE:
return title;
}
......@@ -382,6 +399,7 @@ bool CanToggleAudioMute(content::WebContents* contents) {
case TabAlertState::TAB_CAPTURING:
case TabAlertState::BLUETOOTH_CONNECTED:
case TabAlertState::USB_CONNECTED:
case TabAlertState::DESKTOP_CAPTURING:
// The new Audio Service implements muting separately from the tab audio
// capture infrastructure; so the mute state can be toggled independently
// at all times.
......
......@@ -35,6 +35,7 @@ enum class TabAlertState {
BLUETOOTH_CONNECTED, // Tab is connected to a BT Device.
USB_CONNECTED, // Tab is connected to a USB device.
PIP_PLAYING, // Tab contains a video in Picture-in-Picture mode.
DESKTOP_CAPTURING, // Desktop contents being recorded, consumed by tab.
};
enum class TabMutedReason {
......
......@@ -958,6 +958,7 @@ SkColor Tab::GetAlertIndicatorColor(TabAlertState state) const {
ThemeProperties::COLOR_TAB_ALERT_AUDIO)
: button_color_;
case TabAlertState::MEDIA_RECORDING:
case TabAlertState::DESKTOP_CAPTURING:
return theme_provider->GetColor(
ThemeProperties::COLOR_TAB_ALERT_RECORDING);
case TabAlertState::TAB_CAPTURING:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment