Skip to content

Commit

Permalink
[Merge to M72]shelf: Keep auto-hide shelf shown if menu is shown.
Browse files Browse the repository at this point in the history
TBR=minch@google.com

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 <minch@chromium.org>
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#613320}
Reviewed-on: https://chromium-review.googlesource.com/c/1362456
Reviewed-by: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/branch-heads/3626@{#54}
Cr-Branched-From: d897fb1-refs/heads/master@{#612437}
  • Loading branch information
Min Chen authored and Min Chen committed Dec 5, 2018
1 parent 532a6ea commit 0d1870b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ash/shelf/shelf_layout_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
5 changes: 3 additions & 2 deletions ash/shelf/shelf_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion ash/shelf/shelf_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ash/shelf/shelf_widget.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion ash/shelf/shelf_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0d1870b

Please sign in to comment.