Commit 43f7ae4c authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros:Remove focus highlight when a context menu is shown with the mouse

Per request from UX:
 - Remove the hover highlight which is shown when a context menu
   is shown using mouse. It is only to be used for keyboard focus
   movement.

Also in this cl:
 - Only send the SEND_GESTURE_EVENTS_TO_OWNERS run type when required
   (when the source type is touch). This fixes crbug.com/826939

Bug: 826943
Bug: 826939
Change-Id: Iad31bf5695e88a1bc69efb648664692f01067109
Reviewed-on: https://chromium-review.googlesource.com/991154
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#547919}
parent 557b4fe9
......@@ -299,12 +299,15 @@ void AppListItemView::OnContextMenuModelReceived(
context_menu_items_ = std::move(menu);
UMA_HISTOGRAM_ENUMERATION("Apps.ContextMenuShowSource.AppGrid", source_type,
ui::MenuSourceType::MENU_SOURCE_TYPE_LAST);
ui::MENU_SOURCE_TYPE_LAST);
if (!apps_grid_view_->IsSelectedView(this))
apps_grid_view_->ClearAnySelectedView();
int run_types = views::MenuRunner::HAS_MNEMONICS |
views::MenuRunner::SEND_GESTURE_EVENTS_TO_OWNER;
int run_types = views::MenuRunner::HAS_MNEMONICS;
if (source_type == ui::MENU_SOURCE_TOUCH)
run_types |= views::MenuRunner::SEND_GESTURE_EVENTS_TO_OWNER;
views::MenuAnchorPosition anchor_position = views::MENU_ANCHOR_TOPLEFT;
gfx::Rect anchor_rect = gfx::Rect(point, gfx::Size());
......@@ -313,7 +316,7 @@ void AppListItemView::OnContextMenuModelReceived(
views::MenuRunner::FIXED_ANCHOR |
views::MenuRunner::CONTEXT_MENU;
anchor_position = views::MENU_ANCHOR_BUBBLE_TOUCHABLE_LEFT;
if (source_type == ui::MenuSourceType::MENU_SOURCE_TOUCH) {
if (source_type == ui::MENU_SOURCE_TOUCH) {
// When a context menu is shown by touch, the app icon is temporarily
// enlarged, so use the ideal bounds instead of the current bounds for the
// anchor rect.
......@@ -340,8 +343,6 @@ void AppListItemView::ShowContextMenuForView(views::View* source,
item_weak_->id(),
base::BindOnce(&AppListItemView::OnContextMenuModelReceived,
weak_ptr_factory_.GetWeakPtr(), point, source_type));
source->RequestFocus();
}
bool AppListItemView::IsCommandIdChecked(int command_id) const {
......
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