0

Disable Projector marker tool if the Ink canvas fails to initialize

- Set the marker icon to 30% opacity
- Update the tooltip to indicate Marker failed to load

Bug: b/229268155
Change-Id: I6b8a5783eb057188bb8bc83628cdc186a444a740
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3630846
Commit-Queue: Courtney Wong <courtneywong@chromium.org>
Reviewed-by: Li Lin <llin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1000575}
This commit is contained in:
Courtney Wong
2022-05-06 21:57:32 +00:00
committed by Chromium LUCI CQ
parent b86bce564c
commit 9229fd7737
5 changed files with 21 additions and 0 deletions

@ -1756,6 +1756,10 @@ This file contains the strings for ash.
Marker is off.
</message>
<message name="IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_UNAVAILABLE" desc="Tooltip text for the annotator tray when it is disabled because the marker is not available. Screencast is the name of the app.">
Marker unavailable. Reopen Screencast.
</message>
<!-- Overview Mode -->
<message name="IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME" desc="The accessible name for the Overview button in the system tray.">
Toggle window overview

@ -0,0 +1 @@
663b310b996cd1430605033fe353fcc6d386903a

@ -239,6 +239,18 @@ void ProjectorAnnotationTray::HideAnnotationTray() {
ResetTray();
}
void ProjectorAnnotationTray::OnCanvasInitializationFailed() {
// Set icon color to kIconColorPrimary with 30% opacity.
SkColor disabled_icon_color =
SkColorSetA(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kIconColorPrimary),
0x4D);
image_view_->SetImage(gfx::CreateVectorIcon(kPaletteTrayIconProjectorIcon,
disabled_icon_color));
image_view_->SetTooltipText(l10n_util::GetStringUTF16(
IDS_ASH_STATUS_AREA_PROJECTOR_ANNOTATION_TRAY_UNAVAILABLE));
}
void ProjectorAnnotationTray::ToggleAnnotator() {
if (GetCurrentTool() == kToolNone) {
EnableAnnotatorTool();

@ -43,6 +43,7 @@ class ProjectorAnnotationTray : public TrayBackgroundView {
void OnThemeChanged() override;
void HideAnnotationTray();
void OnCanvasInitializationFailed();
private:
void ToggleAnnotator();

@ -168,6 +168,9 @@ void ProjectorUiController::OnCanvasInitialized(bool success) {
->projector_annotation_tray();
DCHECK(projector_annotation_tray);
projector_annotation_tray->SetEnabled(success);
if (!success) {
projector_annotation_tray->OnCanvasInitializationFailed();
}
}
void ProjectorUiController::OnProjectorSessionActiveStateChanged(bool active) {