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

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

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/controls/menu/menu_host_root_view.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 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 } 499 }
500 500
501 #if defined(OS_LINUX) 501 #if defined(OS_LINUX)
502 bool MenuController::OnMouseWheel(SubmenuView* source, 502 bool MenuController::OnMouseWheel(SubmenuView* source,
503 const ui::MouseWheelEvent& event) { 503 const ui::MouseWheelEvent& event) {
504 MenuPart part = GetMenuPart(source, event.location()); 504 MenuPart part = GetMenuPart(source, event.location());
505 return part.submenu && part.submenu->OnMouseWheel(event); 505 return part.submenu && part.submenu->OnMouseWheel(event);
506 } 506 }
507 #endif 507 #endif
508 508
509 ui::EventResult MenuController::OnGestureEvent( 509 void MenuController::OnGestureEvent(SubmenuView* source,
510 SubmenuView* source, 510 ui::GestureEvent* event) {
511 ui::GestureEvent* event) {
512 MenuPart part = GetMenuPart(source, event->location()); 511 MenuPart part = GetMenuPart(source, event->location());
513 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 512 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
514 SetSelectionOnPointerDown(source, *event); 513 SetSelectionOnPointerDown(source, *event);
515 return ui::ER_CONSUMED; 514 event->StopPropagation();
516 } else if (event->type() == ui::ET_GESTURE_LONG_PRESS) { 515 } else if (event->type() == ui::ET_GESTURE_LONG_PRESS) {
517 if (part.type == MenuPart::MENU_ITEM && part.menu) { 516 if (part.type == MenuPart::MENU_ITEM && part.menu) {
518 if (ShowContextMenu(part.menu, source, *event)) 517 if (ShowContextMenu(part.menu, source, *event))
519 return ui::ER_CONSUMED; 518 event->StopPropagation();
520 } 519 }
521 } else if (event->type() == ui::ET_GESTURE_TAP) { 520 } else if (event->type() == ui::ET_GESTURE_TAP) {
522 if (!part.is_scroll() && part.menu && 521 if (!part.is_scroll() && part.menu &&
523 !(part.menu->HasSubmenu())) { 522 !(part.menu->HasSubmenu())) {
524 if (part.menu->GetDelegate()->IsTriggerableEvent( 523 if (part.menu->GetDelegate()->IsTriggerableEvent(
525 part.menu, *event)) { 524 part.menu, *event)) {
526 Accept(part.menu, 0); 525 Accept(part.menu, 0);
527 } 526 }
528 return ui::ER_CONSUMED; 527 event->StopPropagation();
529 } else if (part.type == MenuPart::MENU_ITEM) { 528 } else if (part.type == MenuPart::MENU_ITEM) {
530 // User either tapped on empty space, or a menu that has children. 529 // User either tapped on empty space, or a menu that has children.
531 SetSelection(part.menu ? part.menu : state_.item, 530 SetSelection(part.menu ? part.menu : state_.item,
532 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); 531 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
533 return ui::ER_CONSUMED; 532 event->StopPropagation();
534 } 533 }
535 } 534 }
535 if (event->stopped_propagation())
536 return;
537
536 if (!part.submenu) 538 if (!part.submenu)
537 return ui::ER_UNHANDLED; 539 return;
538 return part.submenu->OnGestureEvent(event); 540 part.submenu->OnGestureEvent(event);
539 } 541 }
540 542
541 bool MenuController::GetDropFormats( 543 bool MenuController::GetDropFormats(
542 SubmenuView* source, 544 SubmenuView* source,
543 int* formats, 545 int* formats,
544 std::set<OSExchangeData::CustomFormat>* custom_formats) { 546 std::set<OSExchangeData::CustomFormat>* custom_formats) {
545 return source->GetMenuItem()->GetDelegate()->GetDropFormats( 547 return source->GetMenuItem()->GetDelegate()->GetDropFormats(
546 source->GetMenuItem(), formats, custom_formats); 548 source->GetMenuItem(), formats, custom_formats);
547 } 549 }
548 550
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2110 (!pending_state_.item->HasSubmenu() || 2112 (!pending_state_.item->HasSubmenu() ||
2111 !pending_state_.item->GetSubmenu()->IsShowing())) { 2113 !pending_state_.item->GetSubmenu()->IsShowing())) {
2112 // On exit if the user hasn't selected an item with a submenu, move the 2114 // On exit if the user hasn't selected an item with a submenu, move the
2113 // selection back to the parent menu item. 2115 // selection back to the parent menu item.
2114 SetSelection(pending_state_.item->GetParentMenuItem(), 2116 SetSelection(pending_state_.item->GetParentMenuItem(),
2115 SELECTION_OPEN_SUBMENU); 2117 SELECTION_OPEN_SUBMENU);
2116 } 2118 }
2117 } 2119 }
2118 2120
2119 } // namespace views 2121 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_host_root_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698