Update tooltips and screenreader strings for Projector annotator
- Add tooltips to the marker colors. Render the colors as part of the button instead of as a child view because the child view is exepcted to has a tool tip, but a tool tip cannot be set on the base class ui::View (as opposed to a Button) - Update the marker tooltip to indicate the enabled state - Add additional instruction for using the annotator to the screenreader string Tested:https://screencast.googleplex.com/cast/NTE5NTc3ODcxMzcxNDY4OHw3NDk3NzIzZi1hNQ Bug: b/229292077 Bug: b/230110148 Change-Id: I129c50c180eba2c381272c88df9ce1400fd50e1a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3607444 Reviewed-by: Li Lin <llin@chromium.org> Commit-Queue: Courtney Wong <courtneywong@chromium.org> Cr-Commit-Position: refs/heads/main@{#999700}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
5b6e1843eb
commit
dfbaf078b7
ash
ash_strings.grd
ash_strings_grd
IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ACCESSIBLE_TITLE.png.sha1IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_OFF_STATE.png.sha1IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ON_STATE.png.sha1IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TITLE.png.sha1IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TOOLTIP.png.sha1
projector
@@ -1722,8 +1722,20 @@ This file contains the strings for ash.
|
|||||||
Stop screen recording
|
Stop screen recording
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TITLE" desc="The accessible name and title for the projector annotation button in the system tray.">
|
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TOOLTIP" desc="The tooltip for the projector marker button in the system tray, indicating whether the marker is enabled or not.">
|
||||||
Screencast tools
|
Toggle marker. <ph name="STATE_TEXT">$1<ex>Marker is on.</ex></ph>
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ACCESSIBLE_TITLE" desc="The accessible title for the projector marker button in the system tray, telling the user how to use the marker.">
|
||||||
|
Toggle marker. <ph name="STATE_TEXT">$1<ex>Marker is on.</ex></ph> Use the trackpad, touchscreen, or stylus to draw onscreen.
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ON_STATE" desc="Text indicating that the marker is on.">
|
||||||
|
Marker is on.
|
||||||
|
</message>
|
||||||
|
|
||||||
|
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_OFF_STATE" desc="Text indicating that the marker is off.">
|
||||||
|
Marker is off.
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<!-- Overview Mode -->
|
<!-- Overview Mode -->
|
||||||
|
1
ash/ash_strings_grd/IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ACCESSIBLE_TITLE.png.sha1
Normal file
1
ash/ash_strings_grd/IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ACCESSIBLE_TITLE.png.sha1
Normal file
@@ -0,0 +1 @@
|
|||||||
|
f8e710cf8a36f5b5fea864c51903293ef417b34a
|
@@ -0,0 +1 @@
|
|||||||
|
46bb4c9f279dd1221f56effa0cabafd8e0a4b13f
|
@@ -0,0 +1 @@
|
|||||||
|
cb0c8dcc4350a2dfc80e62778ceff2757340f639
|
@@ -1 +0,0 @@
|
|||||||
9a1f2c91aadfd797e1aa2dddbb211968ff58bdc6
|
|
@@ -0,0 +1 @@
|
|||||||
|
f8e710cf8a36f5b5fea864c51903293ef417b34a
|
@@ -96,7 +96,7 @@ ProjectorAnnotationTray::ProjectorAnnotationTray(Shelf* shelf)
|
|||||||
image_view_(
|
image_view_(
|
||||||
tray_container()->AddChildView(std::make_unique<views::ImageView>())),
|
tray_container()->AddChildView(std::make_unique<views::ImageView>())),
|
||||||
pen_view_(nullptr) {
|
pen_view_(nullptr) {
|
||||||
image_view_->SetTooltipText(GetAccessibleNameForTray());
|
image_view_->SetTooltipText(GetTooltip());
|
||||||
image_view_->SetHorizontalAlignment(views::ImageView::Alignment::kCenter);
|
image_view_->SetHorizontalAlignment(views::ImageView::Alignment::kCenter);
|
||||||
image_view_->SetVerticalAlignment(views::ImageView::Alignment::kCenter);
|
image_view_->SetVerticalAlignment(views::ImageView::Alignment::kCenter);
|
||||||
image_view_->SetPreferredSize(gfx::Size(kTrayItemSize, kTrayItemSize));
|
image_view_->SetPreferredSize(gfx::Size(kTrayItemSize, kTrayItemSize));
|
||||||
@@ -134,8 +134,13 @@ void ProjectorAnnotationTray::ClickedOutsideBubble() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::u16string ProjectorAnnotationTray::GetAccessibleNameForTray() {
|
std::u16string ProjectorAnnotationTray::GetAccessibleNameForTray() {
|
||||||
return l10n_util::GetStringUTF16(
|
std::u16string enabled_state = l10n_util::GetStringUTF16(
|
||||||
IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TITLE);
|
GetCurrentTool() == kToolNone
|
||||||
|
? IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_OFF_STATE
|
||||||
|
: IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ON_STATE);
|
||||||
|
return l10n_util::GetStringFUTF16(
|
||||||
|
IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ACCESSIBLE_TITLE,
|
||||||
|
enabled_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectorAnnotationTray::HandleLocaleChange() {}
|
void ProjectorAnnotationTray::HandleLocaleChange() {}
|
||||||
@@ -199,13 +204,13 @@ void ProjectorAnnotationTray::ShowBubble() {
|
|||||||
marker_view_container->SetLayoutManager(std::move(box_layout));
|
marker_view_container->SetLayoutManager(std::move(box_layout));
|
||||||
|
|
||||||
for (SkColor color : kPenColors) {
|
for (SkColor color : kPenColors) {
|
||||||
auto* colorButton = marker_view_container->AddChildView(
|
auto* color_button = marker_view_container->AddChildView(
|
||||||
std::make_unique<ProjectorColorButton>(
|
std::make_unique<ProjectorColorButton>(
|
||||||
base::BindRepeating(&ProjectorAnnotationTray::OnPenColorPressed,
|
base::BindRepeating(&ProjectorAnnotationTray::OnPenColorPressed,
|
||||||
base::Unretained(this), color),
|
base::Unretained(this), color),
|
||||||
color, kColorButtonColorViewSize, kColorButtonViewRadius,
|
color, kColorButtonColorViewSize, kColorButtonViewRadius,
|
||||||
l10n_util::GetStringUTF16(GetAccessibleNameForColor(color))));
|
l10n_util::GetStringUTF16(GetAccessibleNameForColor(color))));
|
||||||
colorButton->SetToggled(current_pen_color_ == color);
|
color_button->SetToggled(current_pen_color_ == color);
|
||||||
}
|
}
|
||||||
setup_layered_view(marker_view_container);
|
setup_layered_view(marker_view_container);
|
||||||
}
|
}
|
||||||
@@ -264,6 +269,7 @@ void ProjectorAnnotationTray::UpdateIcon() {
|
|||||||
GetIconForTool(tool, current_pen_color_),
|
GetIconForTool(tool, current_pen_color_),
|
||||||
AshColorProvider::Get()->GetContentLayerColor(
|
AshColorProvider::Get()->GetContentLayerColor(
|
||||||
AshColorProvider::ContentLayerType::kIconColorPrimary)));
|
AshColorProvider::ContentLayerType::kIconColorPrimary)));
|
||||||
|
image_view_->SetTooltipText(GetTooltip());
|
||||||
SetIsActive(tool != kToolNone);
|
SetIsActive(tool != kToolNone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,4 +306,13 @@ void ProjectorAnnotationTray::ResetTray() {
|
|||||||
SetEnabled(false);
|
SetEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::u16string ProjectorAnnotationTray::GetTooltip() {
|
||||||
|
std::u16string enabled_state = l10n_util::GetStringUTF16(
|
||||||
|
GetCurrentTool() == kToolNone
|
||||||
|
? IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_OFF_STATE
|
||||||
|
: IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_ON_STATE);
|
||||||
|
return l10n_util::GetStringFUTF16(
|
||||||
|
IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_TOOLTIP, enabled_state);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ash
|
} // namespace ash
|
||||||
|
@@ -62,6 +62,8 @@ class ProjectorAnnotationTray : public TrayBackgroundView {
|
|||||||
// Resets the tray to its default state.
|
// Resets the tray to its default state.
|
||||||
void ResetTray();
|
void ResetTray();
|
||||||
|
|
||||||
|
std::u16string GetTooltip();
|
||||||
|
|
||||||
// Image view of the tray icon.
|
// Image view of the tray icon.
|
||||||
views::ImageView* const image_view_;
|
views::ImageView* const image_view_;
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
#include "ash/projector/ui/projector_color_button.h"
|
#include "ash/projector/ui/projector_color_button.h"
|
||||||
|
|
||||||
#include "ash/resources/vector_icons/vector_icons.h"
|
#include "ash/resources/vector_icons/vector_icons.h"
|
||||||
|
#include "ui/gfx/canvas.h"
|
||||||
#include "ui/gfx/paint_vector_icon.h"
|
#include "ui/gfx/paint_vector_icon.h"
|
||||||
#include "ui/views/background.h"
|
#include "ui/views/background.h"
|
||||||
|
|
||||||
@@ -16,13 +17,16 @@ ProjectorColorButton::ProjectorColorButton(
|
|||||||
int size,
|
int size,
|
||||||
float radius,
|
float radius,
|
||||||
const std::u16string& name)
|
const std::u16string& name)
|
||||||
: ProjectorButton(callback, name) {
|
: ProjectorButton(callback, name), color_(color), size_(size) {}
|
||||||
// Add the color view.
|
|
||||||
auto* color_view = AddChildView(std::make_unique<View>());
|
void ProjectorColorButton::PaintButtonContents(gfx::Canvas* canvas) {
|
||||||
color_view->SetBounds((kProjectorButtonSize - size) / 2,
|
cc::PaintFlags flags;
|
||||||
(kProjectorButtonSize - size) / 2, size, size);
|
flags.setAntiAlias(true);
|
||||||
color_view->SetBackground(CreateBackgroundFromPainter(
|
flags.setStyle(cc::PaintFlags::kFill_Style);
|
||||||
views::Painter::CreateSolidRoundRectPainter(color, radius)));
|
flags.setColor(color_);
|
||||||
|
const gfx::RectF bounds(GetContentsBounds());
|
||||||
|
canvas->DrawCircle(bounds.CenterPoint(), (kProjectorButtonSize - size_) / 2,
|
||||||
|
flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ash
|
} // namespace ash
|
||||||
|
@@ -24,6 +24,12 @@ class ASH_EXPORT ProjectorColorButton : public ProjectorButton {
|
|||||||
ProjectorColorButton(const ProjectorColorButton&) = delete;
|
ProjectorColorButton(const ProjectorColorButton&) = delete;
|
||||||
ProjectorColorButton& operator=(const ProjectorColorButton&) = delete;
|
ProjectorColorButton& operator=(const ProjectorColorButton&) = delete;
|
||||||
~ProjectorColorButton() override = default;
|
~ProjectorColorButton() override = default;
|
||||||
|
|
||||||
|
void PaintButtonContents(gfx::Canvas* canvas) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SkColor color_;
|
||||||
|
int size_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ash
|
} // namespace ash
|
||||||
|
Reference in New Issue
Block a user