Commit f7e48dfb authored by minch's avatar minch Committed by Commit Bot

capture_mode: Update tooltips.

Bug: 1136130
Change-Id: I973f58d57415fc83c9638fc36e639963633983af
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2469365
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820429}
parent da3bd2a4
......@@ -2977,10 +2977,10 @@ Here are some things you can try to get started.
Delete
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_CLAMSHELL" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in clamshell mode.">
Click anywhere to capture fullscreen
Click anywhere to capture full screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_FULLSCREEN_IMAGE_CAPTURE_TABLET" desc="The capture label message which shows in the middle of the screen when in fullscreen image capture mode in tablet mode.">
Tap anywhere to catpure fullscreen
Tap anywhere to catpure full screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_REGION_IMAGE_CAPTURE" desc="The caputre label message which shows in the middle of the screen when in region image capture mode.">
Drag to select an area to capture
......@@ -3000,6 +3000,30 @@ Here are some things you can try to get started.
<message name="IDS_ASH_SCREEN_CAPTURE_LABEL_VIDEO_RECORD" desc="The capture label message which shows in the middel of the captured region in region video record mode or shows in the middle of the screen in fullscreen video record mode.">
Record
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_FULLSCREEN_SCREENSHOT" desc="Tooltip of the fullscreen toggle button when in image capture mode.">
Take full screen screenshot
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_FULLSCREEN_RECORD" desc="Tooltip of the fullscreen toggle button when in video record mode.">
Record full screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_REGION_SCREENSHOT" desc="Tooltip of the region toggle button when in image capture mode.">
Take partial screenshot
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_REGION_RECORD" desc="Tooltip of the region toggle button when in video record mode.">
Record partial screen
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_WINDOW_SCREENSHOT" desc="Tooltip of the window toggle button when in image capture mode.">
Take window screenshot
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_WINDOW_RECORD" desc="Tooltip of the window toggle button when in video record mode.">
Record window
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_SCREENSHOT" desc="Tooltip of the toggle button indicates the image capture mode.">
Screenshot
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_TOOLTIP_SCREENRECORD" desc="Tooltip of the toggle button indicates the video record mode.">
Screen record
</message>
<!-- Switch Between TABLET/LAPTOP MODE-->
<message name="IDS_ASH_SWITCH_TO_TABLET_MODE" desc="Alert of switching to tablet mode.">
......
51f6a0e3df171b9ee9339d7875753530d84dcc51
\ No newline at end of file
728a94adb51624cafff28b0c839c2b389c634fdd
\ No newline at end of file
5b2ff157131b82499fc5f821d3087a6752abe965
\ No newline at end of file
2aeb331699f03d895b3af8abe7b1a977c59ab5ca
\ No newline at end of file
e4fd029a129aab8eaa1638c9982281bf1d76a45e
\ No newline at end of file
3c582b11e9b52139086b3cb66ff4a627bfae4a86
\ No newline at end of file
227585a730147ac403b0d368ca2cae5e0b22e07e
\ No newline at end of file
9453e3233acdf36e3b67323930fd6635da1a0656
\ No newline at end of file
c777120c5b9175508a41310e4a3aea5cb13fd59a
\ No newline at end of file
68423bce68701ce6027b7936b4ac36cee3df2b03
\ No newline at end of file
553b2b269908e5eec8a0f566a2e68f76403099d2
\ No newline at end of file
9932d80b33379c55e9039b9d8fff287c3b2b115c
\ No newline at end of file
......@@ -91,6 +91,7 @@ void CaptureModeBarView::OnCaptureSourceChanged(CaptureModeSource new_source) {
void CaptureModeBarView::OnCaptureTypeChanged(CaptureModeType new_type) {
capture_type_view_->OnCaptureTypeChanged(new_type);
capture_source_view_->OnCaptureTypeChanged(new_type);
}
void CaptureModeBarView::OnButtonPressed() {
......
......@@ -9,7 +9,9 @@
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/capture_mode/capture_mode_toggle_button.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "base/bind.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h"
......@@ -36,7 +38,9 @@ CaptureModeSourceView::CaptureModeSourceView()
capture_mode::kBetweenChildSpacing));
box_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
OnCaptureSourceChanged(CaptureModeController::Get()->source());
auto* controller = CaptureModeController::Get();
OnCaptureSourceChanged(controller->source());
OnCaptureTypeChanged(controller->type());
}
CaptureModeSourceView::~CaptureModeSourceView() = default;
......@@ -49,6 +53,19 @@ void CaptureModeSourceView::OnCaptureSourceChanged(
window_toggle_button_->SetToggled(new_source == CaptureModeSource::kWindow);
}
void CaptureModeSourceView::OnCaptureTypeChanged(CaptureModeType new_type) {
const bool is_capturing_image = new_type == CaptureModeType::kImage;
fullscreen_toggle_button_->SetTooltipText(l10n_util::GetStringUTF16(
is_capturing_image ? IDS_ASH_SCREEN_CAPTURE_TOOLTIP_FULLSCREEN_SCREENSHOT
: IDS_ASH_SCREEN_CAPTURE_TOOLTIP_FULLSCREEN_RECORD));
region_toggle_button_->SetTooltipText(l10n_util::GetStringUTF16(
is_capturing_image ? IDS_ASH_SCREEN_CAPTURE_TOOLTIP_REGION_SCREENSHOT
: IDS_ASH_SCREEN_CAPTURE_TOOLTIP_REGION_RECORD));
window_toggle_button_->SetTooltipText(l10n_util::GetStringUTF16(
is_capturing_image ? IDS_ASH_SCREEN_CAPTURE_TOOLTIP_WINDOW_SCREENSHOT
: IDS_ASH_SCREEN_CAPTURE_TOOLTIP_WINDOW_RECORD));
}
void CaptureModeSourceView::OnFullscreenToggle() {
CaptureModeController::Get()->SetSource(CaptureModeSource::kFullscreen);
}
......
......@@ -39,6 +39,9 @@ class ASH_EXPORT CaptureModeSourceView : public views::View {
// Called when the capture source changes.
void OnCaptureSourceChanged(CaptureModeSource new_source);
// Called when the capture type changes to update tooltip texts.
void OnCaptureTypeChanged(CaptureModeType type);
private:
void OnFullscreenToggle();
void OnRegionToggle();
......
......@@ -24,9 +24,6 @@ CaptureModeToggleButton::CaptureModeToggleButton(
SetImageVerticalAlignment(ALIGN_MIDDLE);
GetViewAccessibility().OverrideIsLeaf(true);
// TODO(afakhry): Fix this.
SetTooltipText(base::UTF8ToUTF16(GetClassName()));
SetInstallFocusRingOnFocus(true);
SetFocusForPlatform();
const auto* color_provider = AshColorProvider::Get();
......@@ -57,7 +54,9 @@ void CaptureModeToggleButton::OnPaintBackground(gfx::Canvas* canvas) {
void CaptureModeToggleButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
ImageButton::GetAccessibleNodeData(node_data);
node_data->SetName(GetTooltipText(gfx::Point()));
const base::string16 tooltip = GetTooltipText(gfx::Point());
DCHECK(!tooltip.empty());
node_data->SetName(tooltip);
node_data->role = ax::mojom::Role::kToggleButton;
node_data->SetCheckedState(GetToggled() ? ax::mojom::CheckedState::kTrue
: ax::mojom::CheckedState::kFalse);
......
......@@ -9,8 +9,10 @@
#include "ash/capture_mode/capture_mode_controller.h"
#include "ash/capture_mode/capture_mode_toggle_button.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "base/bind.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/background.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h"
......@@ -50,6 +52,11 @@ CaptureModeTypeView::CaptureModeTypeView()
box_layout->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter);
OnCaptureTypeChanged(CaptureModeController::Get()->type());
image_toggle_button_->SetTooltipText(
l10n_util::GetStringUTF16(IDS_ASH_SCREEN_CAPTURE_TOOLTIP_SCREENSHOT));
video_toggle_button_->SetTooltipText(
l10n_util::GetStringUTF16(IDS_ASH_SCREEN_CAPTURE_TOOLTIP_SCREENRECORD));
}
CaptureModeTypeView::~CaptureModeTypeView() = default;
......
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