Commit 776ab1f6 authored by Jimmy Gong's avatar Jimmy Gong Committed by Chromium LUCI CQ

Phone Hub: Update tooltip to continue task UI cards

Continue task tooltip now features the relative index of the card, title
of the webpage, and the url.

Screenshot: 
https: //storage.cloud.google.com/chromium-translation-screenshots/22fe620f4c048b2352ad6cfe316f63daf6372489
Fixed: 1152780
Change-Id: I099b5dd1d86ad73b9931cdfec15d68203d7ffffb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2570542
Commit-Queue: Jimmy Gong <jimmyxgong@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833172}
parent dbfad503
...@@ -1198,6 +1198,9 @@ This file contains the strings for ash. ...@@ -1198,6 +1198,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_MESSAGE" desc="Message inside a PhoneHub notification when enable hotspot failed to find a connection."> <message name="IDS_ASH_PHONE_HUB_NOTIFICATION_HOTSPOT_FAILED_MESSAGE" desc="Message inside a PhoneHub notification when enable hotspot failed to find a connection.">
Tap to configure Tap to configure
</message> </message>
<message name="IDS_ASH_PHONE_HUB_CONTINUE_BROWSING_TAB_LABEL" desc="Label inside a Phone Hub continue browsing card that describes the index of the card, title of the webpage, and webpage url.">
Browser tab <ph name="INDEX">$1<ex>1</ex></ph> of <ph name="TOTAL_COUNT">$2<ex>2</ex></ph>. <ph name="SITE_TITLE">$3<ex>Google</ex></ph>, <ph name="SITE_URL">$4<ex>https://google.com</ex></ph>
</message>
<message name="IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION" desc="Title of the capture region action in the stylus tools (a pop-up panel next to the status tray). This causes a partial screenshot to be taken (the user selects an area of the screen to take a screenshot of)."> <message name="IDS_ASH_STYLUS_TOOLS_CAPTURE_REGION_ACTION" desc="Title of the capture region action in the stylus tools (a pop-up panel next to the status tray). This causes a partial screenshot to be taken (the user selects an area of the screen to take a screenshot of).">
Capture region Capture region
......
22fe620f4c048b2352ad6cfe316f63daf6372489
\ No newline at end of file
...@@ -8,12 +8,15 @@ ...@@ -8,12 +8,15 @@
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/root_window_controller.h" #include "ash/root_window_controller.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/phonehub/phone_hub_metrics.h" #include "ash/system/phonehub/phone_hub_metrics.h"
#include "ash/system/phonehub/phone_hub_tray.h" #include "ash/system/phonehub/phone_hub_tray.h"
#include "ash/system/status_area_widget.h" #include "ash/system/status_area_widget.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/logging/logging.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
...@@ -36,11 +39,13 @@ constexpr int kTitleMaxLines = 2; ...@@ -36,11 +39,13 @@ constexpr int kTitleMaxLines = 2;
ContinueBrowsingChip::ContinueBrowsingChip( ContinueBrowsingChip::ContinueBrowsingChip(
const chromeos::phonehub::BrowserTabsModel::BrowserTabMetadata& metadata, const chromeos::phonehub::BrowserTabsModel::BrowserTabMetadata& metadata,
int index) int index,
size_t total_count)
: views::Button(base::BindRepeating(&ContinueBrowsingChip::ButtonPressed, : views::Button(base::BindRepeating(&ContinueBrowsingChip::ButtonPressed,
base::Unretained(this))), base::Unretained(this))),
url_(metadata.url), url_(metadata.url),
index_(index) { index_(index),
total_count_(total_count) {
auto* color_provider = AshColorProvider::Get(); auto* color_provider = AshColorProvider::Get();
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
focus_ring()->SetColor(color_provider->GetControlsLayerColor( focus_ring()->SetColor(color_provider->GetControlsLayerColor(
...@@ -102,7 +107,12 @@ ContinueBrowsingChip::ContinueBrowsingChip( ...@@ -102,7 +107,12 @@ ContinueBrowsingChip::ContinueBrowsingChip(
title_label->SetFontList( title_label->SetFontList(
title_label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD)); title_label->font_list().DeriveWithWeight(gfx::Font::Weight::BOLD));
SetTooltipText(metadata.title); const base::string16 card_label = l10n_util::GetStringFUTF16(
IDS_ASH_PHONE_HUB_CONTINUE_BROWSING_TAB_LABEL,
base::NumberToString16(index_ + 1), base::NumberToString16(total_count_),
metadata.title, base::UTF8ToUTF16(url_.spec()));
SetTooltipText(card_label);
SetAccessibleName(card_label);
} }
void ContinueBrowsingChip::OnPaintBackground(gfx::Canvas* canvas) { void ContinueBrowsingChip::OnPaintBackground(gfx::Canvas* canvas) {
......
...@@ -18,7 +18,8 @@ class ASH_EXPORT ContinueBrowsingChip : public views::Button { ...@@ -18,7 +18,8 @@ class ASH_EXPORT ContinueBrowsingChip : public views::Button {
public: public:
ContinueBrowsingChip( ContinueBrowsingChip(
const chromeos::phonehub::BrowserTabsModel::BrowserTabMetadata& metadata, const chromeos::phonehub::BrowserTabsModel::BrowserTabMetadata& metadata,
int index); int index,
size_t total_count);
~ContinueBrowsingChip() override; ~ContinueBrowsingChip() override;
ContinueBrowsingChip(ContinueBrowsingChip&) = delete; ContinueBrowsingChip(ContinueBrowsingChip&) = delete;
...@@ -36,6 +37,9 @@ class ASH_EXPORT ContinueBrowsingChip : public views::Button { ...@@ -36,6 +37,9 @@ class ASH_EXPORT ContinueBrowsingChip : public views::Button {
// The index of the chip as it is ordered in the parent view. // The index of the chip as it is ordered in the parent view.
int index_; int index_;
// The total number of chips in the parent view.
size_t total_count_;
}; };
} // namespace ash } // namespace ash
......
...@@ -182,7 +182,8 @@ void TaskContinuationView::Update() { ...@@ -182,7 +182,8 @@ void TaskContinuationView::Update() {
int index = 0; int index = 0;
for (const BrowserTabsModel::BrowserTabMetadata& metadata : for (const BrowserTabsModel::BrowserTabMetadata& metadata :
browser_tabs.most_recent_tabs()) { browser_tabs.most_recent_tabs()) {
chips_view_->AddTaskChip(new ContinueBrowsingChip(metadata, index)); chips_view_->AddTaskChip(new ContinueBrowsingChip(
metadata, index, browser_tabs.most_recent_tabs().size()));
index++; index++;
} }
......
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