0

video-conference: Add tooltips to unblock testing

Add the tooltips and Accessible strings to unblock the
platform team testing effort.

Tooltips for toggle buttons are:
Toggle <Camera|Mic|Screen Capture>. <Camera|Mic|Screen Capture> is <off|on|on and in use>

Screenshot: https://screenshot.googleplex.com/52K58cuD5QUKBu8.png

Bug: b:253646076
Change-Id: I1e74d544ba4e3daf33e7298f0f22bddc0e8b274e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4425691
Reviewed-by: Andre Le <leandre@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1131425}
This commit is contained in:
Alex Newcomer
2023-04-17 19:22:40 +00:00
committed by Chromium LUCI CQ
parent c2fbf4cddc
commit ba4e4a90d9
12 changed files with 132 additions and 7 deletions

@ -1477,10 +1477,35 @@ Style notes:
Scanning
</message>
<!-- Video Conference tray/bubble -->
<message name="IDS_ASH_VIDEO_CONFERENCE_TOGGLE_BUBBLE_BUTTON_TOOLTIP" desc="The tooltip for the toggle bubble button in the video conference tray.">
<!-- Video Conference tray -->
<message name="IDS_ASH_VIDEO_CONFERENCE_TOGGLE_BUBBLE_BUTTON_TOOLTIP" desc="The tooltip for the toggle bubble button in the video conference tray.">
Camera and audio controls
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_TOOLTIP" desc="Tooltip shown for the toggle buttons shown in the shelf tray. There is a different toggle button for each (Microphone, Camera, Screen Capture). If the button is toggled on, it may also be in-use.">
Toggle <ph name="CAPTURE_MEDIUM">$1<ex>Camera</ex></ph>. <ph name="CAPTURE_MEDIUM">$1<ex>Camera</ex></ph> is <ph name="CAPTURE_STATE">$2<ex>on and in use</ex></ph>
</message>
<message name="VIDEO_CONFERENCE_ONE_WAY_TOGGLE_BUTTON_TOOLTIP" desc="Tooltip shown for a toggle button in the shelf tray which is 'one way', which means that activating the button only turns the behavior off and it cannot be turned back on.">
Stop <ph name="CAPTURE_MEDIUM">$1<ex>Camera</ex></ph>. <ph name="CAPTURE_MEDIUM">$1<ex>Camera</ex></ph> is <ph name="CAPTURE_STATE">$2<ex>on and in use</ex></ph>
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_CAMERA" desc="The portion of the tooltip for the camera toggle button.">
Camera
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE" desc="The portion of the tooltip for the microphone toggle button.">
Microphone
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_SCREEN_SHARE" desc="The portion of the tooltip for the screen capture toggle button.">
Screen Share
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON" desc="The state of the toggle button when the toggle is on but not capturing.">
on
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON_AND_IN_USE" desc="The state of the toggle button when the toggle is on and capturing.">
on and in use
</message>
<message name="VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_OFF" desc="The state of the toggle button when the toggle is muting.">
off
</message>
<!-- Video Conference bubble -->
<message name="IDS_ASH_VIDEO_CONFERENCE_RETURN_TO_APP_SUMMARY_TEXT" desc="The summary text in the return to app panel of the video conference panel, specifying how many video conferencing apps are in used.">
Used by <ph name="APP_COUNT">$1<ex>2</ex></ph> apps
</message>

@ -0,0 +1 @@
01d8e64a2b4fa96743df68f851502a049dcf177c

@ -0,0 +1 @@
cef456df87435c4f9dfa3eb1566915b2fc3fcbea

@ -0,0 +1 @@
658a8a2304570a6a6437384ff723f3e8d22e8d70

@ -0,0 +1 @@
dc15d48a8ebd8e3d899d94ab490b3288936f547e

@ -0,0 +1 @@
658a8a2304570a6a6437384ff723f3e8d22e8d70

@ -0,0 +1 @@
658a8a2304570a6a6437384ff723f3e8d22e8d70

@ -0,0 +1 @@
cef456df87435c4f9dfa3eb1566915b2fc3fcbea

@ -0,0 +1 @@
dc15d48a8ebd8e3d899d94ab490b3288936f547e

@ -24,8 +24,10 @@
#include "ash/system/video_conference/bubble/bubble_view.h"
#include "ash/system/video_conference/video_conference_tray_controller.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "components/session_manager/session_manager_types.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/chromeos/styles/cros_tokens_color_mappings.h"
@ -97,11 +99,16 @@ VideoConferenceTrayButton::VideoConferenceTrayButton(
icon,
accessible_name_id,
/*is_togglable=*/true,
/*has_border=*/true) {
/*has_border=*/true),
accessible_name_id_(accessible_name_id) {
SetBackgroundToggledColorId(cros_tokens::kCrosSysSystemNegativeContainer);
SetIconToggledColorId(cros_tokens::kCrosSysSystemOnNegativeContainer);
SetToggledVectorIcon(*toggled_icon);
SetAccessibleRole(ax::mojom::Role::kToggleButton);
UpdateTooltip();
}
VideoConferenceTrayButton::~VideoConferenceTrayButton() = default;
@ -119,6 +126,12 @@ void VideoConferenceTrayButton::UpdateCapturingState() {
// We should only show the privacy indicator when the button is not
// muted/untoggled.
const bool show_privacy_indicator = is_capturing_ && !toggled();
// Always call `UpdateTooltip()` because even if `show_privacy_indicator_`
// doesn't change, `is_capturing_` may have.
base::ScopedClosureRunner scoped_closure(base::BindOnce(
&VideoConferenceTrayButton::UpdateTooltip, base::Unretained(this)));
if (show_privacy_indicator_ == show_privacy_indicator) {
return;
}
@ -158,6 +171,24 @@ void VideoConferenceTrayButton::PaintButtonContents(gfx::Canvas* canvas) {
kPrivacyIndicatorRadius, flags);
}
void VideoConferenceTrayButton::UpdateTooltip() {
int capture_state_id = VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_OFF;
if (show_privacy_indicator_) {
capture_state_id = VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON_AND_IN_USE;
} else if (!toggled()) {
capture_state_id = VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON;
}
int base_string_id = VIDEO_CONFERENCE_TOGGLE_BUTTON_TOOLTIP;
if (toggle_is_one_way_) {
base_string_id = VIDEO_CONFERENCE_ONE_WAY_TOGGLE_BUTTON_TOOLTIP;
}
SetTooltipText(l10n_util::GetStringFUTF16(
base_string_id, l10n_util::GetStringUTF16(accessible_name_id_),
l10n_util::GetStringUTF16(capture_state_id)));
}
VideoConferenceTray::VideoConferenceTray(Shelf* shelf)
: TrayBackgroundView(shelf,
TrayBackgroundViewCatalogName::kVideoConferenceTray) {
@ -173,7 +204,7 @@ VideoConferenceTray::VideoConferenceTray(Shelf* shelf)
weak_ptr_factory_.GetWeakPtr()),
&kPrivacyIndicatorsMicrophoneIcon,
&kVideoConferenceMicrophoneMutedIcon,
IDS_PRIVACY_NOTIFICATION_TITLE_MIC));
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE));
audio_icon_->SetVisible(false);
camera_icon_ = tray_container()->AddChildView(
@ -181,7 +212,7 @@ VideoConferenceTray::VideoConferenceTray(Shelf* shelf)
base::BindRepeating(&VideoConferenceTray::OnCameraButtonClicked,
weak_ptr_factory_.GetWeakPtr()),
&kPrivacyIndicatorsCameraIcon, &kVideoConferenceCameraMutedIcon,
IDS_PRIVACY_NOTIFICATION_TITLE_CAMERA));
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_CAMERA));
camera_icon_->SetVisible(false);
screen_share_icon_ = tray_container()->AddChildView(
@ -190,7 +221,9 @@ VideoConferenceTray::VideoConferenceTray(Shelf* shelf)
weak_ptr_factory_.GetWeakPtr()),
&kPrivacyIndicatorsScreenShareIcon,
&kPrivacyIndicatorsScreenShareIcon,
IDS_ASH_STATUS_TRAY_SCREEN_SHARE_TITLE));
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_SCREEN_SHARE));
// Toggling screen share stops screen share, and removes the item.
screen_share_icon_->set_toggle_is_one_way();
screen_share_icon_->SetVisible(false);
toggle_bubble_button_ =

@ -60,6 +60,8 @@ class VideoConferenceTrayButton : public IconButton {
~VideoConferenceTrayButton() override;
void set_toggle_is_one_way() { toggle_is_one_way_ = true; }
bool show_privacy_indicator() const { return show_privacy_indicator_; }
bool is_capturing() const { return is_capturing_; }
@ -74,11 +76,24 @@ class VideoConferenceTrayButton : public IconButton {
void PaintButtonContents(gfx::Canvas* canvas) override;
private:
// Updates the tooltip according to the medium the button is for, the toggle
// state, and the capture state.
void UpdateTooltip();
// Cache of the capturing state received from `VideoConferenceManagerAsh`.
bool is_capturing_ = false;
// Indicates whether we are showing the privacy indicator in the button.
// Indicates whether we are showing the privacy indicator (the green dot) in
// the button.
bool show_privacy_indicator_ = false;
// Whether the toggle is a one way operation (like Screen Share). Toggling it
// off makes it dissapear.
bool toggle_is_one_way_ = false;
// The accessible name for this button's capture type (camera, microphone, or
// screen share).
const int accessible_name_id_;
};
// This class represents the VC Controls tray button in the status area and

@ -10,6 +10,7 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/icon_button.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/status_area_widget_test_helper.h"
@ -21,6 +22,7 @@
#include "base/command_line.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_state.h"
@ -619,4 +621,46 @@ TEST_F(VideoConferenceTrayTest, SessionChanged) {
EXPECT_TRUE(video_conference_tray()->GetVisible());
}
// Test that updating the state of a toggle updates the tooltip.
TEST_F(VideoConferenceTrayTest, MutingChangesTooltip) {
auto state = SetTrayAndButtonsVisible();
ASSERT_TRUE(video_conference_tray()->GetVisible());
// The button is not toggled by default, and should not be capturing.
ASSERT_FALSE(audio_icon()->toggled());
EXPECT_EQ(
audio_icon()->GetTooltipText(),
l10n_util::GetStringFUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TOOLTIP,
l10n_util::GetStringUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE),
l10n_util::GetStringUTF16(VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON)));
// Update the state to capturing, the tooltip should update.
state.is_capturing_microphone = true;
controller()->UpdateWithMediaState(state);
EXPECT_EQ(audio_icon()->GetTooltipText(),
l10n_util::GetStringFUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TOOLTIP,
l10n_util::GetStringUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE),
l10n_util::GetStringUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_ON_AND_IN_USE)));
// Toggle the audio off, the tooltip should be updated.
LeftClickOn(audio_icon());
ASSERT_TRUE(controller()->GetMicrophoneMuted());
ASSERT_TRUE(audio_icon()->toggled());
EXPECT_EQ(
audio_icon()->GetTooltipText(),
l10n_util::GetStringFUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TOOLTIP,
l10n_util::GetStringUTF16(
VIDEO_CONFERENCE_TOGGLE_BUTTON_TYPE_MICROPHONE),
l10n_util::GetStringUTF16(VIDEO_CONFERENCE_TOGGLE_BUTTON_STATE_OFF)));
}
} // namespace ash