Commit cb5878d6 authored by Thomas Lukaszewicz's avatar Thomas Lukaszewicz Committed by Commit Bot

Views: Add experimental Tab Search entry-point in the tab strip

This change adds an experimental entry-point for the tab search
feature in the tab strip.

Currently this tab search button instance has been implemented as
another instance of the NewTabButton class, positioned directly next
to the existing new tab button.

The addition of this feature is gated by both the ENABLE_TAB_SEARCH
build flag and the kTabSearch UI feature flag.

Outside of changes gated by the build and feature flags, this CL
wraps the existing new tab button in a |new_tab_button_wrapper_|.
This wrapper allows the addition of the tab search button without
introducing significant changes to existing logic that deals with the
new tab button (ie animation, hit testing, padding etc). This wrapper
is not expected to change the current behavior of the new tab button.

There is follow up work to fix issues such as visual style and
creating a base class inherited by both the actual new tab button
and tab search button.

Bug: 1099917
Change-Id: I63cd0804603a8d25efd4416e4f3ea4307ff6535c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2333341
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795969}
parent d063a6f8
...@@ -5690,6 +5690,9 @@ Keep your key file in a safe place. You will need it to create new versions of y ...@@ -5690,6 +5690,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_TOOLTIP_FIND" desc="The tooltip for the find button"> <message name="IDS_TOOLTIP_FIND" desc="The tooltip for the find button">
Find Find
</message> </message>
<message name="IDS_TOOLTIP_TAB_SEARCH" desc="The tooltip for the Tab Search bubble.">
Tab search
</message>
<!-- Strings for intent picker --> <!-- Strings for intent picker -->
<if expr="not is_android"> <if expr="not is_android">
...@@ -5772,6 +5775,9 @@ the Bookmarks menu."> ...@@ -5772,6 +5775,9 @@ the Bookmarks menu.">
<message name="IDS_ACCNAME_ZOOM_SET_DEFAULT" desc="The accessible description of the Reset button in the Zoom bubble."> <message name="IDS_ACCNAME_ZOOM_SET_DEFAULT" desc="The accessible description of the Reset button in the Zoom bubble.">
Reset to default zoom level Reset to default zoom level
</message> </message>
<message name="IDS_ACCNAME_TAB_SEARCH" desc="The accessible name for the Tab Search bubble.">
Tab search
</message>
<!-- Clipboard permission --> <!-- Clipboard permission -->
<message name="IDS_ALLOWED_CLIPBOARD_TITLE" desc="Title of the info bubble shown when a site has been allowed access to read the contents of the system clipboard."> <message name="IDS_ALLOWED_CLIPBOARD_TITLE" desc="Title of the info bubble shown when a site has been allowed access to read the contents of the system clipboard.">
......
9abc682eb478c03fa60ce766712a08b9b2c6b29b
\ No newline at end of file
dce6b1b6b24f3a9f580a8753a926666e492c68fd
\ No newline at end of file
This diff is collapsed.
...@@ -147,9 +147,9 @@ class TabStrip : public views::AccessiblePaneView, ...@@ -147,9 +147,9 @@ class TabStrip : public views::AccessiblePaneView,
// Sets |stacked_layout_| and animates if necessary. // Sets |stacked_layout_| and animates if necessary.
void SetStackedLayout(bool stacked_layout); void SetStackedLayout(bool stacked_layout);
// Returns the ideal bounds of the new tab button. // Returns the ideal bounds of the tab controls container.
gfx::Rect new_tab_button_ideal_bounds() const { gfx::Rect tab_controls_container_ideal_bounds() const {
return new_tab_button_ideal_bounds_; return tab_controls_container_ideal_bounds_;
} }
// Adds a tab at the specified index. // Adds a tab at the specified index.
...@@ -688,11 +688,16 @@ class TabStrip : public views::AccessiblePaneView, ...@@ -688,11 +688,16 @@ class TabStrip : public views::AccessiblePaneView,
// Responsible for animating tabs in response to model changes. // Responsible for animating tabs in response to model changes.
views::BoundsAnimator bounds_animator_{this}; views::BoundsAnimator bounds_animator_{this};
// The "New Tab" button. // Container that holds the |new_tab_button_| and the |tab_search_button_|.
views::View* tab_controls_container_ = nullptr;
NewTabButton* new_tab_button_ = nullptr; NewTabButton* new_tab_button_ = nullptr;
// |tab_search_button_| will be null if features::kTabSearch is disabled.
// TODO(tluk): Subclass NewTabButton and set the appropriate icon for
// |tab_search_button_|.
NewTabButton* tab_search_button_ = nullptr;
// Ideal bounds of the new tab button. // Ideal bounds of container holding the tab controls.
gfx::Rect new_tab_button_ideal_bounds_; gfx::Rect tab_controls_container_ideal_bounds_;
// If this value is defined, it is used as the width to lay out tabs // If this value is defined, it is used as the width to lay out tabs
// (instead of GetTabAreaWidth()). It is defined when closing tabs with the // (instead of GetTabAreaWidth()). It is defined when closing tabs with the
......
...@@ -866,7 +866,8 @@ TEST_P(TabStripTest, NewTabButtonStaysVisible) { ...@@ -866,7 +866,8 @@ TEST_P(TabStripTest, NewTabButtonStaysVisible) {
CompleteAnimationAndLayout(); CompleteAnimationAndLayout();
EXPECT_LE(tab_strip_->new_tab_button_ideal_bounds().right(), kTabStripWidth); EXPECT_LE(tab_strip_->tab_controls_container_ideal_bounds().right(),
kTabStripWidth);
} }
TEST_P(TabStripTest, NewTabButtonRightOfTabs) { TEST_P(TabStripTest, NewTabButtonRightOfTabs) {
...@@ -877,7 +878,7 @@ TEST_P(TabStripTest, NewTabButtonRightOfTabs) { ...@@ -877,7 +878,7 @@ TEST_P(TabStripTest, NewTabButtonRightOfTabs) {
AnimateToIdealBounds(); AnimateToIdealBounds();
EXPECT_EQ(tab_strip_->new_tab_button_ideal_bounds().x(), EXPECT_EQ(tab_strip_->tab_controls_container_ideal_bounds().x(),
tab_strip_->ideal_bounds(0).right() + TabToNewTabButtonSpacing()); tab_strip_->ideal_bounds(0).right() + TabToNewTabButtonSpacing());
} }
......
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