diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-16 18:06:08 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-16 18:06:08 +0000 |
commit | eb3e52cf67792aede12fd4dcff42d6e9ff83686d (patch) | |
tree | d651cbbc72eafa86834f0e9a503e2116ef40db66 | |
parent | 2189e09e6697118750bcf63852e147005a98a2b7 (diff) | |
download | chromium_src-eb3e52cf67792aede12fd4dcff42d6e9ff83686d.zip chromium_src-eb3e52cf67792aede12fd4dcff42d6e9ff83686d.tar.gz chromium_src-eb3e52cf67792aede12fd4dcff42d6e9ff83686d.tar.bz2 |
Revert 188538 "Closing menu from LauncherMenuItem upon second click"
> Closing menu from LauncherMenuItem upon second click
>
>
> BUG=181308
> TEST=visual
>
>
> Review URL: https://chromiumcodereview.appspot.com/12414008
TBR=skuhne@chromium.org
Review URL: https://codereview.chromium.org/12812017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188605 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/launcher/launcher_view.cc | 20 | ||||
-rw-r--r-- | ash/launcher/launcher_view.h | 7 | ||||
-rw-r--r-- | ui/aura/root_window.cc | 1 | ||||
-rw-r--r-- | ui/views/controls/menu/menu_controller.cc | 12 | ||||
-rw-r--r-- | ui/views/controls/menu/menu_controller.h | 6 | ||||
-rw-r--r-- | ui/views/controls/menu/menu_runner.cc | 21 | ||||
-rw-r--r-- | ui/views/controls/menu/menu_runner.h | 3 |
7 files changed, 4 insertions, 66 deletions
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index 7ea9650..3dfa892 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -374,8 +374,7 @@ LauncherView::LauncherView(LauncherModel* model, context_menu_id_(0), leading_inset_(kDefaultLeadingInset), cancelling_drag_model_changed_(false), - last_hidden_index_(0), - closing_event_time_(base::TimeDelta()) { + last_hidden_index_(0) { DCHECK(model_); bounds_animator_.reset(new views::BoundsAnimator(this)); bounds_animator_->AddObserver(this); @@ -1277,11 +1276,6 @@ void LauncherView::ButtonPressed(views::Button* sender, if (view_index == -1) return; - // If the previous menu was closed by the same event as this one, we ignore - // the call. - if (!IsUsableEvent(event)) - return; - tooltip_->Close(); { @@ -1376,7 +1370,6 @@ void LauncherView::ShowMenu( views::View* source, const gfx::Point& click_point, bool context_menu) { - closing_event_time_ = base::TimeDelta(); launcher_menu_runner_.reset( new views::MenuRunner(menu_model_adapter->CreateMenu())); @@ -1415,7 +1408,6 @@ void LauncherView::ShowMenu( views::MenuRunner::CONTEXT_MENU) == views::MenuRunner::MENU_DELETED) return; - closing_event_time_ = launcher_menu_runner_->closing_event_time(); Shell::GetInstance()->UpdateShelfVisibility(); } @@ -1428,15 +1420,5 @@ void LauncherView::OnBoundsAnimatorProgressed(views::BoundsAnimator* animator) { void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { } -bool LauncherView::IsUsableEvent(const ui::Event& event) { - if (closing_event_time_ == base::TimeDelta()) - return true; - - base::TimeDelta delta = - base::TimeDelta(event.time_stamp() - closing_event_time_); - closing_event_time_ = base::TimeDelta(); - return (delta.InMilliseconds() < 0 || delta.InMilliseconds() > 130); -} - } // namespace internal } // namespace ash diff --git a/ash/launcher/launcher_view.h b/ash/launcher/launcher_view.h index 2207a3e..fa02579 100644 --- a/ash/launcher/launcher_view.h +++ b/ash/launcher/launcher_view.h @@ -233,10 +233,6 @@ class ASH_EXPORT LauncherView : public views::View, views::BoundsAnimator* animator) OVERRIDE; virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; - // Returns false if the click which closed the previous menu is the click - // which triggered this event. - bool IsUsableEvent(const ui::Event& event); - // The model; owned by Launcher. LauncherModel* model_; @@ -302,9 +298,6 @@ class ASH_EXPORT LauncherView : public views::View, // will be equal to last_visible_index_ + 1. int last_hidden_index_; - // The timestamp of the event which closed the last menu - or 0. - base::TimeDelta closing_event_time_; - DISALLOW_COPY_AND_ASSIGN(LauncherView); }; diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index d66ad30..6ddc1c5 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -1104,7 +1104,6 @@ void RootWindow::DispatchHeldEvents() { ui::MouseEvent mouse_event( static_cast<const ui::MouseEvent&>(*held_repostable_event_.get())); held_repostable_event_.reset(); // must be reset before dispatch -LOG(ERROR) << "Disptch: " << mouse_event.time_stamp().ToInternalValue(); DispatchMouseEventRepost(&mouse_event); } else { DCHECK(held_repostable_event_->type() == ui::ET_GESTURE_TAP_DOWN); diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 9b8db7d..c557479 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -285,7 +285,6 @@ MenuItemView* MenuController::Run(Widget* parent, exit_type_ = EXIT_NONE; possible_drag_ = false; drag_in_progress_ = false; - closing_event_time_ = base::TimeDelta(); bool nested_menu = showing_; if (showing_) { @@ -816,14 +815,6 @@ void MenuController::SetSelectionOnPointerDown(SubmenuView* source, if (part.type == MenuPart::NONE || (part.type == MenuPart::MENU_ITEM && part.menu && part.menu->GetRootMenuItem() != state_.item->GetRootMenuItem())) { - // Remember the time when we repost the event. The owner can then use this - // to figure out if this menu was finished with the same click which is - // sent to it thereafter. Note that the time stamp front he event cannot be - // used since the reposting will set a new timestamp when the event gets - // processed. As such it is better to take the current time which will be - // closer to the time when it arrives again in the menu handler. - closing_event_time_ = ui::EventTimeForNow(); - // Mouse wasn't pressed over any menu, or the active menu, cancel. #if defined(OS_WIN) && !defined(USE_AURA) @@ -1092,8 +1083,7 @@ MenuController::MenuController(ui::NativeTheme* theme, active_mouse_view_(NULL), delegate_(delegate), message_loop_depth_(0), - menu_config_(theme), - closing_event_time_(base::TimeDelta()) { + menu_config_(theme) { active_instance_ = this; } diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h index 6d2e5fb..38aeb9d 100644 --- a/ui/views/controls/menu/menu_controller.h +++ b/ui/views/controls/menu/menu_controller.h @@ -98,9 +98,6 @@ class VIEWS_EXPORT MenuController : public MessageLoop::Dispatcher, // the menu is being canceled. ExitType exit_type() const { return exit_type_; } - // Returns the time from the event which closed the menu - or 0. - base::TimeDelta closing_event_time() const { return closing_event_time_; } - // Various events, forwarded from the submenu. // // NOTE: the coordinates of the events are in that of the @@ -564,9 +561,6 @@ class VIEWS_EXPORT MenuController : public MessageLoop::Dispatcher, views::MenuConfig menu_config_; - // The timestamp of the event which closed the menu - or 0 otherwise. - base::TimeDelta closing_event_time_; - DISALLOW_COPY_AND_ASSIGN(MenuController); }; diff --git a/ui/views/controls/menu/menu_runner.cc b/ui/views/controls/menu/menu_runner.cc index 694503c..af2165b 100644 --- a/ui/views/controls/menu/menu_runner.cc +++ b/ui/views/controls/menu/menu_runner.cc @@ -75,9 +75,6 @@ class MenuRunnerImpl : public internal::MenuControllerDelegate { void Cancel(); - // Returns the time from the event which closed the menu - or 0. - base::TimeDelta closing_event_time() const; - // MenuControllerDelegate: virtual void DropMenuClosed(NotifyType type, MenuItemView* menu) OVERRIDE; virtual void SiblingMenuCreated(MenuItemView* menu) OVERRIDE; @@ -120,9 +117,6 @@ class MenuRunnerImpl : public internal::MenuControllerDelegate { // Do we own the controller? bool owns_controller_; - // The timestamp of the event which closed the menu - or 0. - base::TimeDelta closing_event_time_; - DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); }; @@ -132,8 +126,7 @@ MenuRunnerImpl::MenuRunnerImpl(MenuItemView* menu) delete_after_run_(false), for_drop_(false), controller_(NULL), - owns_controller_(false), - closing_event_time_(base::TimeDelta()) { + owns_controller_(false) { } void MenuRunnerImpl::Release() { @@ -169,7 +162,6 @@ MenuRunner::RunResult MenuRunnerImpl::RunMenuAt( const gfx::Rect& bounds, MenuItemView::AnchorPosition anchor, int32 types) { - closing_event_time_ = base::TimeDelta(); if (running_) { // Ignore requests to show the menu while it's already showing. MenuItemView // doesn't handle this very well (meaning it crashes). @@ -221,8 +213,7 @@ MenuRunner::RunResult MenuRunnerImpl::RunMenuAt( MenuItemView* result = controller->Run(parent, button, menu_, bounds, anchor, (types & MenuRunner::CONTEXT_MENU) != 0, &mouse_event_flags); - // Get the time of the event which closed this menu. - closing_event_time_ = controller->closing_event_time(); + if (for_drop_) { // Drop menus return immediately. We finish processing in DropMenuClosed. return MenuRunner::NORMAL_EXIT; @@ -236,10 +227,6 @@ void MenuRunnerImpl::Cancel() { controller_->Cancel(MenuController::EXIT_ALL); } -base::TimeDelta MenuRunnerImpl::closing_event_time() const { - return closing_event_time_; -} - void MenuRunnerImpl::DropMenuClosed(NotifyType type, MenuItemView* menu) { MenuDone(NULL, 0); @@ -352,8 +339,4 @@ void MenuRunner::Cancel() { holder_->Cancel(); } -base::TimeDelta MenuRunner::closing_event_time() const { - return holder_->closing_event_time(); -} - } // namespace views diff --git a/ui/views/controls/menu/menu_runner.h b/ui/views/controls/menu/menu_runner.h index cd95c0a..7752708 100644 --- a/ui/views/controls/menu/menu_runner.h +++ b/ui/views/controls/menu/menu_runner.h @@ -96,9 +96,6 @@ class VIEWS_EXPORT MenuRunner { // Hides and cancels the menu. This does nothing if the menu is not open. void Cancel(); - // Returns the time from the event which closed the menu - or 0. - base::TimeDelta closing_event_time() const; - private: internal::MenuRunnerImpl* holder_; |