diff options
-rw-r--r-- | ui/views/controls/button/menu_button.cc | 7 | ||||
-rw-r--r-- | ui/views/controls/button/menu_button.h | 4 | ||||
-rw-r--r-- | ui/views/controls/combobox/native_combobox_views.cc | 7 | ||||
-rw-r--r-- | ui/views/controls/combobox/native_combobox_views.h | 9 |
4 files changed, 7 insertions, 20 deletions
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc index 5a20d52..765c9ef 100644 --- a/ui/views/controls/button/menu_button.cc +++ b/ui/views/controls/button/menu_button.cc @@ -26,15 +26,18 @@ using base::TimeDelta; namespace views { +// The amount of time, in milliseconds, we wait before allowing another mouse +// pressed event to show the menu. +static const int64 kMinimumTimeBetweenButtonClicks = 100; + // Default menu offset. static const int kDefaultMenuOffsetX = -2; static const int kDefaultMenuOffsetY = -4; // static -const char MenuButton::kViewClassName[] = "MenuButton"; -const int64 MenuButton::kMinimumTimeBetweenButtonClicks = 100; const int MenuButton::kMenuMarkerPaddingLeft = 3; const int MenuButton::kMenuMarkerPaddingRight = -1; +const char MenuButton::kViewClassName[] = "MenuButton"; //////////////////////////////////////////////////////////////////////////////// // diff --git a/ui/views/controls/button/menu_button.h b/ui/views/controls/button/menu_button.h index e3f657b..e33ec18 100644 --- a/ui/views/controls/button/menu_button.h +++ b/ui/views/controls/button/menu_button.h @@ -28,10 +28,6 @@ class VIEWS_EXPORT MenuButton : public TextButton { public: static const char kViewClassName[]; - // The amount of time, in milliseconds, we wait before allowing another mouse - // pressed event to show the menu. - static const int64 kMinimumTimeBetweenButtonClicks; - // How much padding to put on the left and right of the menu marker. static const int kMenuMarkerPaddingLeft; static const int kMenuMarkerPaddingRight; diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc index 7a0d873..8ef1efa 100644 --- a/ui/views/controls/combobox/native_combobox_views.cc +++ b/ui/views/controls/combobox/native_combobox_views.cc @@ -19,7 +19,6 @@ #include "ui/views/background.h" #include "ui/views/border.h" #include "ui/views/color_constants.h" -#include "ui/views/controls/button/menu_button.h" #include "ui/views/controls/combobox/combobox.h" #include "ui/views/controls/focusable_border.h" #include "ui/views/controls/menu/menu_runner.h" @@ -98,9 +97,7 @@ NativeComboboxViews::~NativeComboboxViews() { bool NativeComboboxViews::OnMousePressed(const ui::MouseEvent& mouse_event) { combobox_->RequestFocus(); - const base::TimeDelta delta = base::Time::Now() - closed_time_; - if (mouse_event.IsLeftMouseButton() && - (delta.InMilliseconds() > MenuButton::kMinimumTimeBetweenButtonClicks)) { + if (mouse_event.IsLeftMouseButton()) { UpdateFromModel(); ShowDropDownMenu(ui::MENU_SOURCE_MOUSE); } @@ -372,6 +369,7 @@ void NativeComboboxViews::PaintText(gfx::Canvas* canvas) { } void NativeComboboxViews::ShowDropDownMenu(ui::MenuSourceType source_type) { + if (!dropdown_list_menu_runner_.get()) UpdateFromModel(); @@ -403,7 +401,6 @@ void NativeComboboxViews::ShowDropDownMenu(ui::MenuSourceType source_type) { MenuRunner::MENU_DELETED) return; dropdown_open_ = false; - closed_time_ = base::Time::Now(); // Need to explicitly clear mouse handler so that events get sent // properly after the menu finishes running. If we don't do this, then diff --git a/ui/views/controls/combobox/native_combobox_views.h b/ui/views/controls/combobox/native_combobox_views.h index bdf7033..3384b8a 100644 --- a/ui/views/controls/combobox/native_combobox_views.h +++ b/ui/views/controls/combobox/native_combobox_views.h @@ -5,7 +5,6 @@ #ifndef UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ #define UI_VIEWS_CONTROLS_COMBOBOX_NATIVE_COMBOBOX_VIEWS_H_ -#include "base/time/time.h" #include "ui/views/controls/combobox/native_combobox_wrapper.h" #include "ui/views/controls/menu/menu_delegate.h" #include "ui/views/view.h" @@ -91,14 +90,6 @@ class NativeComboboxViews : public views::View, // Is the drop down list showing bool dropdown_open_; - // Like MenuButton, we use a time object in order to keep track of when the - // combobox was closed. The time is used for simulating menu behavior; that - // is, if the menu is shown and the button is pressed, we need to close the - // menu. There is no clean way to get the second click event because the - // menu is displayed using a modal loop and, unlike regular menus in Windows, - // the button is not part of the displayed menu. - base::Time closed_time_; - // The selected index in the model. The default value is -1, which means no // selection. int selected_index_; |