diff options
author | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 23:17:20 +0000 |
---|---|---|
committer | msw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 23:17:20 +0000 |
commit | 2c831b235ec39e7e4258cfd93b735de06f079a0e (patch) | |
tree | f0a49df25f1d7736bd8483de7cf09794fc06f055 /views/controls/menu | |
parent | 05a1ba49bd770a52a3a84aa2ce6241b0e538d7da (diff) | |
download | chromium_src-2c831b235ec39e7e4258cfd93b735de06f079a0e.zip chromium_src-2c831b235ec39e7e4258cfd93b735de06f079a0e.tar.gz chromium_src-2c831b235ec39e7e4258cfd93b735de06f079a0e.tar.bz2 |
Clean up some event code:
Update some RootView event construction.
Fixup some *MouseExited/OnLeaveNotify codepaths.
Normalize event argument names.
Move View::ConvertPoint*Ancestor defs to private section.
Review URL: http://codereview.chromium.org/6685018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/menu')
-rw-r--r-- | views/controls/menu/menu_controller.cc | 16 | ||||
-rw-r--r-- | views/controls/menu/menu_controller.h | 4 | ||||
-rw-r--r-- | views/controls/menu/menu_host_root_view.cc | 8 | ||||
-rw-r--r-- | views/controls/menu/menu_host_root_view.h | 4 |
4 files changed, 16 insertions, 16 deletions
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc index 62f41e5..baabf69 100644 --- a/views/controls/menu/menu_controller.cc +++ b/views/controls/menu/menu_controller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -1025,13 +1025,14 @@ void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { result_mouse_event_flags_ = mouse_event_flags; } -bool MenuController::ShowSiblingMenu(SubmenuView* source, const MouseEvent& e) { +bool MenuController::ShowSiblingMenu(SubmenuView* source, + const MouseEvent& event) { if (!menu_stack_.empty() || !menu_button_) return false; View* source_view = source->GetScrollViewContainer(); - if (e.x() >= 0 && e.x() < source_view->width() && e.y() >= 0 && - e.y() < source_view->height()) { + if (event.x() >= 0 && event.x() < source_view->width() && event.y() >= 0 && + event.y() < source_view->height()) { // The mouse is over the menu, no need to continue. return false; } @@ -1042,7 +1043,7 @@ bool MenuController::ShowSiblingMenu(SubmenuView* source, const MouseEvent& e) { // The user moved the mouse outside the menu and over the owning window. See // if there is a sibling menu we should show. - gfx::Point screen_point(e.location()); + gfx::Point screen_point(event.location()); View::ConvertPointToScreen(source_view, &screen_point); MenuItemView::AnchorPosition anchor; bool has_mnemonics; @@ -1787,10 +1788,9 @@ void MenuController::UpdateActiveMouseView(SubmenuView* event_source, } if (target != active_mouse_view_) { if (active_mouse_view_) { + // TODO(msw): Revise api and uses with OnMouseCaptureLost (like ui/views). // Send a mouse release with cancel set to true. - MouseEvent release_event(ui::ET_MOUSE_RELEASED, -1, -1, 0); - active_mouse_view_->OnMouseReleased(release_event, true); - + active_mouse_view_->OnMouseReleased(event, true); active_mouse_view_ = NULL; } active_mouse_view_ = target; diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h index dfd68b4..3838c45 100644 --- a/views/controls/menu/menu_controller.h +++ b/views/controls/menu/menu_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -238,7 +238,7 @@ class MenuController : public MessageLoopForUI::Dispatcher { // when blocking. This schedules the loop to quit. void Accept(MenuItemView* item, int mouse_event_flags); - bool ShowSiblingMenu(SubmenuView* source, const MouseEvent& e); + bool ShowSiblingMenu(SubmenuView* source, const MouseEvent& event); // Closes all menus, including any menus of nested invocations of Run. void CloseAllNestedMenus(); diff --git a/views/controls/menu/menu_host_root_view.cc b/views/controls/menu/menu_host_root_view.cc index cc0124c..bb791fc 100644 --- a/views/controls/menu/menu_host_root_view.cc +++ b/views/controls/menu/menu_host_root_view.cc @@ -66,17 +66,17 @@ void MenuHostRootView::OnMouseMoved(const MouseEvent& event) { GetMenuController()->OnMouseMoved(submenu_, event); } -bool MenuHostRootView::OnMouseWheel(const MouseWheelEvent& e) { +bool MenuHostRootView::OnMouseWheel(const MouseWheelEvent& event) { // RootView::OnMouseWheel forwards to the focused view. We don't have a // focused view, so we need to override this then forward to the menu. - return submenu_->OnMouseWheel(e); + return submenu_->OnMouseWheel(event); } -void MenuHostRootView::ProcessOnMouseExited() { +void MenuHostRootView::OnMouseExited(const MouseEvent& event) { if (suspend_events_) return; - RootView::ProcessOnMouseExited(); + RootView::OnMouseExited(event); } MenuController* MenuHostRootView::GetMenuController() { diff --git a/views/controls/menu/menu_host_root_view.h b/views/controls/menu/menu_host_root_view.h index 00648b4..f989170 100644 --- a/views/controls/menu/menu_host_root_view.h +++ b/views/controls/menu/menu_host_root_view.h @@ -32,8 +32,8 @@ class MenuHostRootView : public RootView { virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE; virtual void OnMouseReleased(const MouseEvent& event, bool canceled) OVERRIDE; virtual void OnMouseMoved(const MouseEvent& event) OVERRIDE; - virtual bool OnMouseWheel(const MouseWheelEvent& e) OVERRIDE; - virtual void ProcessOnMouseExited() OVERRIDE; + virtual bool OnMouseWheel(const MouseWheelEvent& event) OVERRIDE; + virtual void OnMouseExited(const MouseEvent& event) OVERRIDE; private: // Returns the MenuController for this MenuHostRootView. |