0

Add search result title to remove dialog.

This CL also updates the dialog to be a removal dialog instead of a
deletion dialog. Screenshot can be found in bug.

Bug: 1115418
Change-Id: I15a15968c6709d44119df7fb97e5a8da433d7e06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3575998
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Auto-Submit: Yulun Wu <yulunwu@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#990144}
This commit is contained in:
Yulun Wu
2022-04-07 22:06:41 +00:00
committed by Chromium LUCI CQ
parent 7dbfbaa509
commit fc51635ca3
10 changed files with 29 additions and 20 deletions

@ -26,7 +26,8 @@ constexpr int kDialogWidth = 320;
} // namespace
LegacyRemoveQueryConfirmationDialog::LegacyRemoveQueryConfirmationDialog(
RemovalConfirmationCallback confirm_callback)
RemovalConfirmationCallback confirm_callback,
const std::u16string& result_title)
: confirm_callback_(std::move(confirm_callback)) {
SetModalType(ui::MODAL_TYPE_WINDOW);
SetTitle(l10n_util::GetStringUTF16(IDS_REMOVE_ZERO_STATE_SUGGESTION_TITLE));
@ -52,12 +53,12 @@ LegacyRemoveQueryConfirmationDialog::LegacyRemoveQueryConfirmationDialog(
views::DialogContentType::kText),
provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)));
views::Label* label = new views::Label(
l10n_util::GetStringUTF16(IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS));
auto* label =
AddChildView(std::make_unique<views::Label>(l10n_util::GetStringFUTF16(
IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS, result_title)));
label->SetMultiLine(true);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetAllowCharacterBreak(true);
AddChildView(label);
}
LegacyRemoveQueryConfirmationDialog::~LegacyRemoveQueryConfirmationDialog() =

@ -23,8 +23,8 @@ class LegacyRemoveQueryConfirmationDialog : public views::DialogDelegateView {
// associated result.
using RemovalConfirmationCallback = base::OnceCallback<void(bool)>;
explicit LegacyRemoveQueryConfirmationDialog(
RemovalConfirmationCallback callback);
LegacyRemoveQueryConfirmationDialog(RemovalConfirmationCallback callback,
const std::u16string& result_title);
LegacyRemoveQueryConfirmationDialog(
const LegacyRemoveQueryConfirmationDialog&) = delete;

@ -46,7 +46,8 @@ constexpr int kMarginBetweenButtons = 8;
} // namespace
RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog(
RemovalConfirmationCallback confirm_callback)
RemovalConfirmationCallback confirm_callback,
const std::u16string& result_title)
: confirm_callback_(std::move(confirm_callback)) {
SetModalType(ui::MODAL_TYPE_WINDOW);
@ -75,8 +76,9 @@ RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog(
title_->GetViewAccessibility().OverrideIsIgnored(true);
// Add dialog body.
body_ = AddChildView(std::make_unique<views::Label>(
l10n_util::GetStringUTF16(IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS)));
body_ =
AddChildView(std::make_unique<views::Label>(l10n_util::GetStringFUTF16(
IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS, result_title)));
body_->SetProperty(views::kMarginsKey,
gfx::Insets::TLBR(kMarginBetweenTitleAndBody, 0,
kMarginBetweenBodyAndButtons, 0));

@ -30,7 +30,8 @@ class RemoveQueryConfirmationDialog : public views::WidgetDelegateView {
// associated result.
using RemovalConfirmationCallback = base::OnceCallback<void(bool)>;
explicit RemoveQueryConfirmationDialog(RemovalConfirmationCallback callback);
RemoveQueryConfirmationDialog(RemovalConfirmationCallback callback,
const std::u16string& result_title);
RemoveQueryConfirmationDialog(const RemoveQueryConfirmationDialog&) = delete;
RemoveQueryConfirmationDialog& operator=(

@ -1275,11 +1275,13 @@ void SearchResultView::OnSearchResultActionActivated(size_t index) {
if (features::IsProductivityLauncherEnabled()) {
dialog = std::make_unique<RemoveQueryConfirmationDialog>(
base::BindOnce(&SearchResultView::OnQueryRemovalAccepted,
weak_ptr_factory_.GetWeakPtr()));
weak_ptr_factory_.GetWeakPtr()),
result()->title());
} else {
dialog = std::make_unique<LegacyRemoveQueryConfirmationDialog>(
base::BindOnce(&SearchResultView::OnQueryRemovalAccepted,
weak_ptr_factory_.GetWeakPtr()));
weak_ptr_factory_.GetWeakPtr()),
result()->title());
}
dialog_controller_->Show(std::move(dialog));
break;

@ -4652,16 +4652,18 @@ New install
Displaying 1 result for <ph name="query">$1<ex>search query</ex></ph>
</message>
<message name="IDS_REMOVE_ZERO_STATE_SUGGESTION_TITLE" desc="Titlebar of removing zero state suggestion confirmation dialog">
Delete this search from your history?
Remove this suggestion?
</message>
<message name="IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS" desc="Detailed explanation message for removing removing an omnibox search result from launcher search results UI. This is a text in the dialog shown to the user when they try to remove a suggested omnibox search result from list of results shown in the launcher search - the omnibox search result may appear if the search query in launcher search matches a previous user search. The dialog asks the user to confirm the result removal.">
You searched for this query before. Deleting this search from your history will permanently remove it from your Google Account across all of your devices.
<message name="IDS_REMOVE_ZERO_STATE_SUGGESTION_DETAILS" desc="Detailed explanation message for removing removing an omnibox search result from launcher search results UI. This is a text in the dialog shown to the user when they try to remove a suggested omnibox search result from list of results shown in the launcher search - the omnibox search result may appear if the search query in launcher search matches a previous user search. The dialog asks the user to confirm the result removal. The query being removed is showing one linebreak after the message. The linebreak should NOT be removed from the string.">
The following suggestion will be permanently removed from your accounts suggestion history:
<ph name="query">$1<ex>suggestion</ex></ph>
</message>
<message name="IDS_REMOVE_SUGGESTION_ANNOUNCEMENT" desc="Announcement confirming the removal of an omnibox suggestion from the launcher search results UI.">
Search history result deleted
Search history result removed
</message>
<message name="IDS_REMOVE_SUGGESTION_BUTTON_LABEL" desc="Remove suggestion button label">
Delete
Remove
</message>
<message name="IDS_APP_LIST_KEYBOARD_SHORTCUT_OR" desc="Joiner text for several keyboard shortcuts that all do the same thing. Eg: 'Ctrl-A or Ctrl-B or Ctrl-C'">
Or

@ -1 +1 @@
921a6cc624f8e4df4b4a11dd8b417edd1abbc1d7
a7eef578b60baaec69282cb78ccd1af5249032c6

@ -1 +1 @@
6b121537d382709ea33681163e9a40ded7905fb8
a07c74b0247695fe1966c8490ad29955738f3ba1

@ -1 +1 @@
6b121537d382709ea33681163e9a40ded7905fb8
a07c74b0247695fe1966c8490ad29955738f3ba1

@ -0,0 +1 @@
a07c74b0247695fe1966c8490ad29955738f3ba1