Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 154203002: Remove unnecessary uses of aura::Env::GetDispatcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/focus/accelerator_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windowsx.h> 8 #include <windowsx.h>
9 #endif 9 #endif
10 10
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 const ui::MouseEvent& event) { 589 const ui::MouseEvent& event) {
590 HandleMouseLocation(source, event.location()); 590 HandleMouseLocation(source, event.location());
591 } 591 }
592 592
593 void MenuController::OnMouseEntered(SubmenuView* source, 593 void MenuController::OnMouseEntered(SubmenuView* source,
594 const ui::MouseEvent& event) { 594 const ui::MouseEvent& event) {
595 // MouseEntered is always followed by a mouse moved, so don't need to 595 // MouseEntered is always followed by a mouse moved, so don't need to
596 // do anything here. 596 // do anything here.
597 } 597 }
598 598
599 #if defined(USE_AURA)
600 bool MenuController::OnMouseWheel(SubmenuView* source, 599 bool MenuController::OnMouseWheel(SubmenuView* source,
601 const ui::MouseWheelEvent& event) { 600 const ui::MouseWheelEvent& event) {
602 MenuPart part = GetMenuPart(source, event.location()); 601 MenuPart part = GetMenuPart(source, event.location());
603 return part.submenu && part.submenu->OnMouseWheel(event); 602 return part.submenu && part.submenu->OnMouseWheel(event);
604 } 603 }
605 #endif
606 604
607 void MenuController::OnGestureEvent(SubmenuView* source, 605 void MenuController::OnGestureEvent(SubmenuView* source,
608 ui::GestureEvent* event) { 606 ui::GestureEvent* event) {
609 MenuPart part = GetMenuPart(source, event->location()); 607 MenuPart part = GetMenuPart(source, event->location());
610 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 608 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
611 SetSelectionOnPointerDown(source, *event); 609 SetSelectionOnPointerDown(source, *event);
612 event->StopPropagation(); 610 event->StopPropagation();
613 } else if (event->type() == ui::ET_GESTURE_LONG_PRESS) { 611 } else if (event->type() == ui::ET_GESTURE_LONG_PRESS) {
614 if (part.type == MenuPart::MENU_ITEM && part.menu) { 612 if (part.type == MenuPart::MENU_ITEM && part.menu) {
615 if (ShowContextMenu(part.menu, source, *event, ui::MENU_SOURCE_TOUCH)) 613 if (ShowContextMenu(part.menu, source, *event, ui::MENU_SOURCE_TOUCH))
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 Cancel(EXIT_ALL); 1052 Cancel(EXIT_ALL);
1055 return false; 1053 return false;
1056 1054
1057 default: 1055 default:
1058 break; 1056 break;
1059 } 1057 }
1060 TranslateMessage(&msg); 1058 TranslateMessage(&msg);
1061 DispatchMessage(&msg); 1059 DispatchMessage(&msg);
1062 return exit_type_ == EXIT_NONE; 1060 return exit_type_ == EXIT_NONE;
1063 } 1061 }
1064 #elif defined(USE_AURA) 1062 #else
1065 bool MenuController::Dispatch(const base::NativeEvent& event) { 1063 bool MenuController::Dispatch(const base::NativeEvent& event) {
1066 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { 1064 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) {
1067 aura::Env::GetInstance()->GetDispatcher()->Dispatch(event); 1065 aura::Env::GetInstance()->GetDispatcher()->Dispatch(event);
1068 return false; 1066 return false;
1069 } 1067 }
1070 // Activates mnemonics only when it it pressed without modifiers except for 1068 // Activates mnemonics only when it it pressed without modifiers except for
1071 // caps and shift. 1069 // caps and shift.
1072 int flags = ui::EventFlagsFromNative(event) & 1070 int flags = ui::EventFlagsFromNative(event) &
1073 ~ui::EF_CAPS_LOCK_DOWN & ~ui::EF_SHIFT_DOWN; 1071 ~ui::EF_CAPS_LOCK_DOWN & ~ui::EF_SHIFT_DOWN;
1074 if (flags == ui::EF_NONE) { 1072 if (flags == ui::EF_NONE) {
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 (!pending_state_.item->HasSubmenu() || 2335 (!pending_state_.item->HasSubmenu() ||
2338 !pending_state_.item->GetSubmenu()->IsShowing())) { 2336 !pending_state_.item->GetSubmenu()->IsShowing())) {
2339 // On exit if the user hasn't selected an item with a submenu, move the 2337 // On exit if the user hasn't selected an item with a submenu, move the
2340 // selection back to the parent menu item. 2338 // selection back to the parent menu item.
2341 SetSelection(pending_state_.item->GetParentMenuItem(), 2339 SetSelection(pending_state_.item->GetParentMenuItem(),
2342 SELECTION_OPEN_SUBMENU); 2340 SELECTION_OPEN_SUBMENU);
2343 } 2341 }
2344 } 2342 }
2345 2343
2346 } // namespace views 2344 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/focus/accelerator_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698