Skip to content

Commit 0d1870b

Browse files
Min ChenMin Chen
Min Chen
authored and
Min Chen
committed
[Merge to M72]shelf: Keep auto-hide shelf shown if menu is shown.
[email protected] Open the application select menu of chrome shortcut will trigger the window stacking change. It will update the shelf visibility before showing the menu. Call UpdateVisibilityState after the menu is shown to keep the auto-hide shelf shown. (cherry picked from commit 2be72dc) Bug: 908681 Change-Id: I1e4dca91a03ca85df5ddb1511bd2b4f3fe6c8d63 Reviewed-on: https://chromium-review.googlesource.com/c/1356595 Commit-Queue: Min Chen <[email protected]> Reviewed-by: Xiyuan Xia <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#613320} Reviewed-on: https://chromium-review.googlesource.com/c/1362456 Reviewed-by: Min Chen <[email protected]> Cr-Commit-Position: refs/branch-heads/3626@{#54} Cr-Branched-From: d897fb1-refs/heads/master@{#612437}
1 parent 532a6ea commit 0d1870b

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

ash/shelf/shelf_layout_manager.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
10031003
return SHELF_AUTO_HIDE_SHOWN;
10041004
}
10051005

1006-
if (shelf_widget_->IsShowingContextMenu())
1006+
if (shelf_widget_->IsShowingMenu())
10071007
return SHELF_AUTO_HIDE_SHOWN;
10081008

10091009
if (shelf_widget_->IsShowingOverflowBubble())

ash/shelf/shelf_view.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,8 +1994,9 @@ void ShelfView::AfterItemSelected(
19941994
ShowMenu(std::make_unique<ShelfApplicationMenuModel>(
19951995
item.title, std::move(*menu_items),
19961996
model_->GetShelfItemDelegate(item.id)),
1997-
sender, gfx::Point(), false,
1997+
sender, gfx::Point(), /*context_menu=*/false,
19981998
ui::GetMenuSourceTypeForEvent(*event));
1999+
shelf_->UpdateVisibilityState();
19992000
} else {
20002001
ink_drop->AnimateToState(views::InkDropState::ACTION_TRIGGERED);
20012002
}
@@ -2015,7 +2016,7 @@ void ShelfView::AfterGetContextMenuItems(
20152016
std::make_unique<ShelfContextMenuModel>(
20162017
std::move(menu_items), model_->GetShelfItemDelegate(shelf_id),
20172018
display_id);
2018-
ShowMenu(std::move(menu_model), source, point, true /* context_menu */,
2019+
ShowMenu(std::move(menu_model), source, point, /*context_menu=*/true,
20192020
source_type);
20202021
}
20212022

ash/shelf/shelf_view.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ class ASH_EXPORT ShelfView : public views::View,
131131
// will be returned.
132132
gfx::Rect GetIdealBoundsOfItemIcon(const ShelfID& id);
133133

134-
// Returns true if we're showing a menu.
134+
// Returns true if we're showing a menu. Note the menu could be either the
135+
// context menu or the application select menu.
135136
bool IsShowingMenu() const;
136137

137138
// Returns true if we're showing a menu for |view|. |view| could be a

ash/shelf/shelf_widget.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ bool ShelfWidget::IsShowingAppList() const {
408408
return GetAppListButton() && GetAppListButton()->is_showing_app_list();
409409
}
410410

411-
bool ShelfWidget::IsShowingContextMenu() const {
411+
bool ShelfWidget::IsShowingMenu() const {
412412
return shelf_view_->IsShowingMenu();
413413
}
414414

ash/shelf/shelf_widget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ASH_EXPORT ShelfWidget : public views::Widget,
8181
void PostCreateShelf();
8282

8383
bool IsShowingAppList() const;
84-
bool IsShowingContextMenu() const;
84+
bool IsShowingMenu() const;
8585
bool IsShowingOverflowBubble() const;
8686

8787
// Sets the focus cycler. Also adds the shelf to the cycle.

0 commit comments

Comments
 (0)