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

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

Issue 10912063: events: Get rid of GestureStatus in favour of EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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/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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 } 514 }
515 515
516 #if defined(OS_LINUX) 516 #if defined(OS_LINUX)
517 bool MenuController::OnMouseWheel(SubmenuView* source, 517 bool MenuController::OnMouseWheel(SubmenuView* source,
518 const ui::MouseWheelEvent& event) { 518 const ui::MouseWheelEvent& event) {
519 MenuPart part = GetMenuPart(source, event.location()); 519 MenuPart part = GetMenuPart(source, event.location());
520 return part.submenu && part.submenu->OnMouseWheel(event); 520 return part.submenu && part.submenu->OnMouseWheel(event);
521 } 521 }
522 #endif 522 #endif
523 523
524 ui::GestureStatus MenuController::OnGestureEvent( 524 ui::EventResult MenuController::OnGestureEvent(
525 SubmenuView* source, 525 SubmenuView* source,
526 const ui::GestureEvent& event) { 526 const ui::GestureEvent& event) {
527 MenuPart part = GetMenuPart(source, event.location()); 527 MenuPart part = GetMenuPart(source, event.location());
528 if (event.type() == ui::ET_GESTURE_TAP_DOWN) { 528 if (event.type() == ui::ET_GESTURE_TAP_DOWN) {
529 SetSelectionOnPointerDown(source, event); 529 SetSelectionOnPointerDown(source, event);
530 return ui::GESTURE_STATUS_CONSUMED; 530 return ui::ER_CONSUMED;
531 } else if (event.type() == ui::ET_GESTURE_LONG_PRESS) { 531 } else if (event.type() == ui::ET_GESTURE_LONG_PRESS) {
532 if (part.type == MenuPart::MENU_ITEM && part.menu) { 532 if (part.type == MenuPart::MENU_ITEM && part.menu) {
533 if (ShowContextMenu(part.menu, source, event)) 533 if (ShowContextMenu(part.menu, source, event))
534 return ui::GESTURE_STATUS_CONSUMED; 534 return ui::ER_CONSUMED;
535 } 535 }
536 } else if (event.type() == ui::ET_GESTURE_TAP) { 536 } else if (event.type() == ui::ET_GESTURE_TAP) {
537 if (!part.is_scroll() && part.menu && 537 if (!part.is_scroll() && part.menu &&
538 !(part.menu->HasSubmenu())) { 538 !(part.menu->HasSubmenu())) {
539 if (part.menu->GetDelegate()->IsTriggerableEvent( 539 if (part.menu->GetDelegate()->IsTriggerableEvent(
540 part.menu, event)) { 540 part.menu, event)) {
541 Accept(part.menu, 0); 541 Accept(part.menu, 0);
542 } 542 }
543 return ui::GESTURE_STATUS_CONSUMED; 543 return ui::ER_CONSUMED;
544 } else if (part.type == MenuPart::MENU_ITEM) { 544 } else if (part.type == MenuPart::MENU_ITEM) {
545 // User either tapped on empty space, or a menu that has children. 545 // User either tapped on empty space, or a menu that has children.
546 SetSelection(part.menu ? part.menu : state_.item, 546 SetSelection(part.menu ? part.menu : state_.item,
547 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); 547 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
548 return ui::GESTURE_STATUS_CONSUMED; 548 return ui::ER_CONSUMED;
549 } 549 }
550 } 550 }
551 if (!part.submenu) 551 if (!part.submenu)
552 return ui::GESTURE_STATUS_UNKNOWN; 552 return ui::ER_UNHANDLED;
553 return part.submenu->OnGestureEvent(event); 553 return part.submenu->OnGestureEvent(event);
554 } 554 }
555 555
556 bool MenuController::GetDropFormats( 556 bool MenuController::GetDropFormats(
557 SubmenuView* source, 557 SubmenuView* source,
558 int* formats, 558 int* formats,
559 std::set<OSExchangeData::CustomFormat>* custom_formats) { 559 std::set<OSExchangeData::CustomFormat>* custom_formats) {
560 return source->GetMenuItem()->GetDelegate()->GetDropFormats( 560 return source->GetMenuItem()->GetDelegate()->GetDropFormats(
561 source->GetMenuItem(), formats, custom_formats); 561 source->GetMenuItem(), formats, custom_formats);
562 } 562 }
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 2119
2120 #if defined(USE_AURA) 2120 #if defined(USE_AURA)
2121 void MenuController::OnWindowActivated(aura::Window* active, 2121 void MenuController::OnWindowActivated(aura::Window* active,
2122 aura::Window* old_active) { 2122 aura::Window* old_active) {
2123 if (!drag_in_progress_) 2123 if (!drag_in_progress_)
2124 Cancel(EXIT_ALL); 2124 Cancel(EXIT_ALL);
2125 } 2125 }
2126 #endif 2126 #endif
2127 2127
2128 } // namespace views 2128 } // 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