Commit 57c15809 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove TranslateBubbleView CreateFootnoteView

Bug: 1011446
Change-Id: Ie6043c36e60c2aeedee7722907ef6816f0972b6f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1901430Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713435}
parent 24e1399f
......@@ -89,6 +89,39 @@ bool UseGoogleTranslateBranding() {
#endif
}
std::unique_ptr<views::View> CreateWordmarkView(
language::TranslateUIBubbleModel bubble_model) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (bubble_model != language::TranslateUIBubbleModel::TAB) {
return nullptr;
}
auto view = std::make_unique<views::View>();
views::GridLayout* layout =
view->SetLayoutManager(std::make_unique<views::GridLayout>());
// Translate icon
const int translate_icon_id = IDR_TRANSLATE_TAB_WORDMARK;
std::unique_ptr<views::ImageView> translate_icon =
std::make_unique<views::ImageView>();
gfx::ImageSkia* translate_icon_image =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
translate_icon_id);
translate_icon->SetImage(*translate_icon_image);
views::ColumnSet* cs = layout->AddColumnSet(0);
cs->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
views::GridLayout::kFixedSize, views::GridLayout::USE_PREF, 0,
0);
layout->StartRow(1, 0);
layout->AddView(std::move(translate_icon));
return view;
#else
return nullptr;
#endif
}
} // namespace
// static
......@@ -344,38 +377,6 @@ void TranslateBubbleView::ButtonPressed(views::Button* sender,
}
}
std::unique_ptr<views::View> TranslateBubbleView::CreateFootnoteView() {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
if (bubble_ui_model_ != language::TranslateUIBubbleModel::TAB) {
return nullptr;
}
auto view = std::make_unique<views::View>();
views::GridLayout* layout =
view->SetLayoutManager(std::make_unique<views::GridLayout>());
// Translate icon
const int translate_icon_id = IDR_TRANSLATE_TAB_WORDMARK;
std::unique_ptr<views::ImageView> translate_icon =
std::make_unique<views::ImageView>();
gfx::ImageSkia* translate_icon_image =
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
translate_icon_id);
translate_icon->SetImage(*translate_icon_image);
views::ColumnSet* cs = layout->AddColumnSet(0);
cs->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER,
views::GridLayout::kFixedSize, views::GridLayout::USE_PREF, 0,
0);
layout->StartRow(1, 0);
layout->AddView(std::move(translate_icon));
return view;
#else
return nullptr;
#endif
}
views::View* TranslateBubbleView::GetInitiallyFocusedView() {
return GetCurrentView()->GetNextFocusableView();
}
......@@ -658,6 +659,7 @@ TranslateBubbleView::TranslateBubbleView(
if (web_contents) // web_contents can be null in unit_tests.
mouse_handler_ =
std::make_unique<WebContentMouseHandler>(this, web_contents);
DialogDelegate::SetFootnoteView(CreateWordmarkView(bubble_ui_model_));
chrome::RecordDialogCreation(chrome::DialogIdentifier::TRANSLATE);
}
......
......@@ -92,7 +92,6 @@ class TranslateBubbleView : public LocationBarBubbleDelegateView,
base::string16 GetWindowTitle() const override;
void Init() override;
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
std::unique_ptr<views::View> CreateFootnoteView() override;
// views::WidgetDelegate methods.
View* GetInitiallyFocusedView() override;
......
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