Commit dce6f34f authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[omnibox] Hook up Dedicated Row buttons to translated strings

This CL replaces the placeholder English strings with their
internationalized equivalent.

Bug: 893183
Change-Id: I62f828c6db7fb40a421feb2352fb4f49a5fa1738
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363641
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799440}
parent f0fe519c
......@@ -14,8 +14,10 @@
#include "components/omnibox/browser/omnibox_edit_model.h"
#include "components/omnibox/browser/omnibox_pedal.h"
#include "components/omnibox/browser/vector_icons.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "third_party/metrics_proto/omnibox_event.pb.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/animation/ink_drop_highlight.h"
......@@ -90,22 +92,6 @@ class OmniboxSuggestionRowButton : public views::MdTextButton {
}
};
namespace {
OmniboxSuggestionRowButton* CreatePillButton(
OmniboxSuggestionButtonRowView* button_row,
const char* message,
const gfx::VectorIcon& icon,
const views::FocusRing::ViewPredicate& predicate) {
OmniboxSuggestionRowButton* button =
button_row->AddChildView(std::make_unique<OmniboxSuggestionRowButton>(
button_row, base::ASCIIToUTF16(message), icon, predicate));
button->SetVisible(false);
return button;
}
} // namespace
OmniboxSuggestionButtonRowView::OmniboxSuggestionButtonRowView(
OmniboxPopupContentsView* popup_contents_view,
int model_index)
......@@ -131,16 +117,22 @@ OmniboxSuggestionButtonRowView::OmniboxSuggestionButtonRowView(
};
};
// TODO(orinj): Use the real translated string table values here instead.
keyword_button_ = CreatePillButton(
this, "Keyword search", vector_icons::kSearchIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_KEYWORD));
tab_switch_button_ = CreatePillButton(
this, "Switch to this tab", omnibox::kSwitchIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_TAB_SWITCH));
pedal_button_ =
CreatePillButton(this, "Pedal", omnibox::kProductIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_PEDAL));
// For all of these buttons, the visibility set from UpdateFromModel().
// The Keyword and Pedal buttons also get their text from there, since the
// text depends on the actual match. That shouldn't produce a flicker, because
// it's called directly from OmniboxResultView::SetMatch(). If this flickers,
// then so does everything else in the result view.
keyword_button_ = AddChildView(std::make_unique<OmniboxSuggestionRowButton>(
this, base::string16(), vector_icons::kSearchIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_KEYWORD)));
tab_switch_button_ =
AddChildView(std::make_unique<OmniboxSuggestionRowButton>(
this, l10n_util::GetStringUTF16(IDS_OMNIBOX_TAB_SUGGEST_HINT),
omnibox::kSwitchIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_TAB_SWITCH)));
pedal_button_ = AddChildView(std::make_unique<OmniboxSuggestionRowButton>(
this, base::string16(), omnibox::kProductIcon,
make_predicate(OmniboxPopupModel::FOCUSED_BUTTON_PEDAL)));
}
OmniboxSuggestionButtonRowView::~OmniboxSuggestionButtonRowView() = 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