Commit b51f3c6e authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Use ui::GetMenuSourceTypeForEvent() consistently.

As far as I can tell from examining the affected locations, any possible
behavior changes are either oversights or can't really happen.

Bug: none
Change-Id: I7bf4095d15c022a6a35f672871d123b96c96c604
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248350
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Reviewed-by: default avatarThomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779320}
parent 66faa2f0
......@@ -691,17 +691,9 @@ void DownloadItemView::ButtonPressed(views::Button* sender,
}
if (sender == dropdown_button_) {
// TODO(estade): this is copied from ToolbarActionView but should be shared
// one way or another.
ui::MenuSourceType type = ui::MENU_SOURCE_NONE;
if (event.IsMouseEvent())
type = ui::MENU_SOURCE_MOUSE;
else if (event.IsKeyEvent())
type = ui::MENU_SOURCE_KEYBOARD;
else if (event.IsGestureEvent())
type = ui::MENU_SOURCE_TOUCH;
SetDropdownState(PUSHED);
ShowContextMenuImpl(dropdown_button_->GetBoundsInScreen(), type);
ShowContextMenuImpl(dropdown_button_->GetBoundsInScreen(),
ui::GetMenuSourceTypeForEvent(event));
return;
}
......
......@@ -17,6 +17,7 @@
#include "ui/base/ime/input_method.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/ui_base_types.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
......@@ -526,16 +527,8 @@ void Combobox::ButtonPressed(Button* sender, const ui::Event& event) {
// TODO(hajimehoshi): Fix the problem that the arrow button blinks when
// cliking this while the dropdown menu is opened.
const base::TimeDelta delta = base::TimeTicks::Now() - closed_time_;
if (delta <= kMinimumTimeBetweenButtonClicks)
return;
ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
if (event.IsKeyEvent())
source_type = ui::MENU_SOURCE_KEYBOARD;
else if (event.IsGestureEvent() || event.IsTouchEvent())
source_type = ui::MENU_SOURCE_TOUCH;
ShowDropDownMenu(source_type);
if ((base::TimeTicks::Now() - closed_time_) > kMinimumTimeBetweenButtonClicks)
ShowDropDownMenu(ui::GetMenuSourceTypeForEvent(event));
}
void Combobox::OnComboboxModelChanged(ui::ComboboxModel* model) {
......
......@@ -441,16 +441,10 @@ void EditableCombobox::OnViewBlurred(View* observed_view) {
void EditableCombobox::ButtonPressed(Button* sender, const ui::Event& event) {
textfield_->RequestFocus();
if (menu_runner_ && menu_runner_->IsRunning()) {
if (menu_runner_ && menu_runner_->IsRunning())
CloseMenu();
return;
}
ui::MenuSourceType source_type = ui::MENU_SOURCE_MOUSE;
if (event.IsKeyEvent())
source_type = ui::MENU_SOURCE_KEYBOARD;
else if (event.IsGestureEvent() || event.IsTouchEvent())
source_type = ui::MENU_SOURCE_TOUCH;
ShowDropDownMenu(source_type);
else
ShowDropDownMenu(ui::GetMenuSourceTypeForEvent(event));
}
void EditableCombobox::OnLayoutIsAnimatingChanged(
......
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