Commit 1a71db15 authored by Robbie Gibson's avatar Robbie Gibson Committed by Chromium LUCI CQ

[iOS][Thumb Strip] Keep thumb strip open when switching tabs

When the thumb strip is in peeked state (horizontal tab thumbnails),
switching tabs should not close the thumb strip.

Bug: 1155211
Change-Id: I8b6e7312af391538dbea155a10433e8ade9d01fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600983
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avataredchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840596}
parent e45c62b5
...@@ -151,6 +151,9 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -151,6 +151,9 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
// Button with a plus sign that opens a new tab, located on the right side of // Button with a plus sign that opens a new tab, located on the right side of
// the thumb strip, shown when the plus sign cell isn't visible. // the thumb strip, shown when the plus sign cell isn't visible.
@property(nonatomic, weak) ThumbStripPlusSignButton* plusSignButton; @property(nonatomic, weak) ThumbStripPlusSignButton* plusSignButton;
// The current state of the tab grid when using the thumb strip.
@property(nonatomic, assign) ViewRevealState currentState;
@end @end
@implementation TabGridViewController @implementation TabGridViewController
...@@ -501,6 +504,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -501,6 +504,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
#pragma mark - ViewRevealingAnimatee #pragma mark - ViewRevealingAnimatee
- (void)willAnimateViewReveal:(ViewRevealState)currentViewRevealState { - (void)willAnimateViewReveal:(ViewRevealState)currentViewRevealState {
self.currentState = currentViewRevealState;
self.scrollView.scrollEnabled = NO; self.scrollView.scrollEnabled = NO;
switch (currentViewRevealState) { switch (currentViewRevealState) {
case ViewRevealState::Hidden: { case ViewRevealState::Hidden: {
...@@ -590,6 +594,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -590,6 +594,7 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
} }
- (void)didAnimateViewReveal:(ViewRevealState)viewRevealState { - (void)didAnimateViewReveal:(ViewRevealState)viewRevealState {
self.currentState = viewRevealState;
switch (viewRevealState) { switch (viewRevealState) {
case ViewRevealState::Hidden: case ViewRevealState::Hidden:
[self.delegate tabGridViewControllerDidDismiss:self]; [self.delegate tabGridViewControllerDidDismiss:self];
...@@ -1413,9 +1418,11 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) { ...@@ -1413,9 +1418,11 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
base::UserMetricsAction("MobileTabGridOpenIncognitoTab")); base::UserMetricsAction("MobileTabGridOpenIncognitoTab"));
} }
self.activePage = self.currentPage; self.activePage = self.currentPage;
// When the tab grid is peeked, selecting an item should not close the grid.
BOOL closeTabGrid = self.currentState != ViewRevealState::Peeked;
[self.tabPresentationDelegate showActiveTabInPage:self.currentPage [self.tabPresentationDelegate showActiveTabInPage:self.currentPage
focusOmnibox:NO focusOmnibox:NO
closeTabGrid:YES]; closeTabGrid:closeTabGrid];
gridViewController.showsSelectionUpdates = YES; gridViewController.showsSelectionUpdates = YES;
} }
......
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