Commit 2be72dc0 authored by Min Chen's avatar Min Chen Committed by Commit Bot

shelf: Keep auto-hide shelf shown if menu is shown.

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.

Bug: 908681
Change-Id: I1e4dca91a03ca85df5ddb1511bd2b4f3fe6c8d63
Reviewed-on: https://chromium-review.googlesource.com/c/1356595
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613320}
parent 44910c30
......@@ -1003,7 +1003,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
return SHELF_AUTO_HIDE_SHOWN;
}
if (shelf_widget_->IsShowingContextMenu())
if (shelf_widget_->IsShowingMenu())
return SHELF_AUTO_HIDE_SHOWN;
if (shelf_widget_->IsShowingOverflowBubble())
......
......@@ -1994,8 +1994,9 @@ void ShelfView::AfterItemSelected(
ShowMenu(std::make_unique<ShelfApplicationMenuModel>(
item.title, std::move(*menu_items),
model_->GetShelfItemDelegate(item.id)),
sender, gfx::Point(), false,
sender, gfx::Point(), /*context_menu=*/false,
ui::GetMenuSourceTypeForEvent(*event));
shelf_->UpdateVisibilityState();
} else {
ink_drop->AnimateToState(views::InkDropState::ACTION_TRIGGERED);
}
......@@ -2015,7 +2016,7 @@ void ShelfView::AfterGetContextMenuItems(
std::make_unique<ShelfContextMenuModel>(
std::move(menu_items), model_->GetShelfItemDelegate(shelf_id),
display_id);
ShowMenu(std::move(menu_model), source, point, true /* context_menu */,
ShowMenu(std::move(menu_model), source, point, /*context_menu=*/true,
source_type);
}
......
......@@ -131,7 +131,8 @@ class ASH_EXPORT ShelfView : public views::View,
// will be returned.
gfx::Rect GetIdealBoundsOfItemIcon(const ShelfID& id);
// Returns true if we're showing a menu.
// Returns true if we're showing a menu. Note the menu could be either the
// context menu or the application select menu.
bool IsShowingMenu() const;
// Returns true if we're showing a menu for |view|. |view| could be a
......
......@@ -408,7 +408,7 @@ bool ShelfWidget::IsShowingAppList() const {
return GetAppListButton() && GetAppListButton()->is_showing_app_list();
}
bool ShelfWidget::IsShowingContextMenu() const {
bool ShelfWidget::IsShowingMenu() const {
return shelf_view_->IsShowingMenu();
}
......
......@@ -81,7 +81,7 @@ class ASH_EXPORT ShelfWidget : public views::Widget,
void PostCreateShelf();
bool IsShowingAppList() const;
bool IsShowingContextMenu() const;
bool IsShowingMenu() const;
bool IsShowingOverflowBubble() const;
// Sets the focus cycler. Also adds the shelf to the cycle.
......
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