Commit 192ee160 authored by Leonard Grey's avatar Leonard Grey Committed by Commit Bot

Remove FindBarButton

It's not doing enough to justify a subclass anymore IMO.

Bug: None
Change-Id: I8cfc07e6c1f7eb3ca11f097db5fdcaf147522c74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881718Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Leonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709909}
parent e7ed11f0
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/bubble/bubble_border.h" #include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/image_button_factory.h" #include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
...@@ -49,14 +48,13 @@ ...@@ -49,14 +48,13 @@
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
// An ImageButton that has a centered circular highlight. namespace {
class FindBarView::FindBarButton : public views::ImageButton { void SetCommonButtonAttributes(views::ImageButton* button) {
public: views::ConfigureVectorImageButton(button);
explicit FindBarButton(views::ButtonListener* listener) views::InstallCircleHighlightPathGenerator(button);
: ImageButton(listener) { button->SetFocusForPlatform();
views::InstallCircleHighlightPathGenerator(this); }
} } // namespace
};
class FindBarView::MatchCountLabel : public views::Label { class FindBarView::MatchCountLabel : public views::Label {
public: public:
...@@ -135,30 +133,27 @@ FindBarView::FindBarView(FindBarHost* host) : find_bar_host_(host) { ...@@ -135,30 +133,27 @@ FindBarView::FindBarView(FindBarHost* host) : find_bar_host_(host) {
separator->set_can_process_events_within_subtree(false); separator->set_can_process_events_within_subtree(false);
separator_ = AddChildView(std::move(separator)); separator_ = AddChildView(std::move(separator));
auto find_previous_button = std::make_unique<FindBarButton>(this); auto find_previous_button = std::make_unique<views::ImageButton>(this);
views::ConfigureVectorImageButton(find_previous_button.get()); SetCommonButtonAttributes(find_previous_button.get());
find_previous_button->SetID(VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON); find_previous_button->SetID(VIEW_ID_FIND_IN_PAGE_PREVIOUS_BUTTON);
find_previous_button->SetFocusForPlatform();
find_previous_button->SetTooltipText( find_previous_button->SetTooltipText(
l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)); l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP));
find_previous_button->SetAccessibleName( find_previous_button->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)); l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS));
find_previous_button_ = AddChildView(std::move(find_previous_button)); find_previous_button_ = AddChildView(std::move(find_previous_button));
auto find_next_button = std::make_unique<FindBarButton>(this); auto find_next_button = std::make_unique<views::ImageButton>(this);
views::ConfigureVectorImageButton(find_next_button.get()); SetCommonButtonAttributes(find_next_button.get());
find_next_button->SetID(VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON); find_next_button->SetID(VIEW_ID_FIND_IN_PAGE_NEXT_BUTTON);
find_next_button->SetFocusForPlatform();
find_next_button->SetTooltipText( find_next_button->SetTooltipText(
l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)); l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP));
find_next_button->SetAccessibleName( find_next_button->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)); l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT));
find_next_button_ = AddChildView(std::move(find_next_button)); find_next_button_ = AddChildView(std::move(find_next_button));
auto close_button = std::make_unique<FindBarButton>(this); auto close_button = std::make_unique<views::ImageButton>(this);
views::ConfigureVectorImageButton(close_button.get()); SetCommonButtonAttributes(close_button.get());
close_button->SetID(VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON); close_button->SetID(VIEW_ID_FIND_IN_PAGE_CLOSE_BUTTON);
close_button->SetFocusForPlatform();
close_button->SetTooltipText( close_button->SetTooltipText(
l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)); l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP));
close_button->SetAnimationDuration(base::TimeDelta()); close_button->SetAnimationDuration(base::TimeDelta());
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/textfield/textfield_controller.h" #include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -82,7 +83,6 @@ class FindBarView : public views::View, ...@@ -82,7 +83,6 @@ class FindBarView : public views::View,
void OnAfterPaste() override; void OnAfterPaste() override;
private: private:
class FindBarButton;
class MatchCountLabel; class MatchCountLabel;
// Starts finding |search_text|. If the text is empty, stops finding. // Starts finding |search_text|. If the text is empty, stops finding.
...@@ -107,9 +107,9 @@ class FindBarView : public views::View, ...@@ -107,9 +107,9 @@ class FindBarView : public views::View,
std::unique_ptr<views::Painter> find_text_border_; std::unique_ptr<views::Painter> find_text_border_;
MatchCountLabel* match_count_text_; MatchCountLabel* match_count_text_;
views::Separator* separator_; views::Separator* separator_;
FindBarButton* find_previous_button_; views::ImageButton* find_previous_button_;
FindBarButton* find_next_button_; views::ImageButton* find_next_button_;
FindBarButton* close_button_; views::ImageButton* close_button_;
// The preferred height of the find bar. // The preferred height of the find bar.
int preferred_height_; int preferred_height_;
......
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