| OLD | NEW |
| 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // We can use Ctrl+click or the middle mouse button to recursively open urls | 467 // We can use Ctrl+click or the middle mouse button to recursively open urls |
| 468 // for selected folder menu items. If it's only a left click, show the | 468 // for selected folder menu items. If it's only a left click, show the |
| 469 // contents of the folder. | 469 // contents of the folder. |
| 470 if (!part.is_scroll() && part.menu && | 470 if (!part.is_scroll() && part.menu && |
| 471 !(part.menu->HasSubmenu() && | 471 !(part.menu->HasSubmenu() && |
| 472 (event.flags() & ui::EF_LEFT_MOUSE_BUTTON))) { | 472 (event.flags() & ui::EF_LEFT_MOUSE_BUTTON))) { |
| 473 if (active_mouse_view_) { | 473 if (active_mouse_view_) { |
| 474 SendMouseReleaseToActiveView(source, event); | 474 SendMouseReleaseToActiveView(source, event); |
| 475 return; | 475 return; |
| 476 } | 476 } |
| 477 if (part.menu->GetDelegate()->ShouldExecuteCommandWithoutClosingMenu( |
| 478 part.menu->GetCommand(), event)) { |
| 479 part.menu->GetDelegate()->ExecuteCommand(part.menu->GetCommand(), |
| 480 event.flags()); |
| 481 return; |
| 482 } |
| 477 if (!part.menu->NonIconChildViewsCount() && | 483 if (!part.menu->NonIconChildViewsCount() && |
| 478 part.menu->GetDelegate()->IsTriggerableEvent(part.menu, event)) { | 484 part.menu->GetDelegate()->IsTriggerableEvent(part.menu, event)) { |
| 479 Accept(part.menu, event.flags()); | 485 Accept(part.menu, event.flags()); |
| 480 return; | 486 return; |
| 481 } | 487 } |
| 482 } else if (part.type == MenuPart::MENU_ITEM) { | 488 } else if (part.type == MenuPart::MENU_ITEM) { |
| 483 // User either clicked on empty space, or a menu that has children. | 489 // User either clicked on empty space, or a menu that has children. |
| 484 SetSelection(part.menu ? part.menu : state_.item, | 490 SetSelection(part.menu ? part.menu : state_.item, |
| 485 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); | 491 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); |
| 486 } | 492 } |
| (...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 (!pending_state_.item->HasSubmenu() || | 2139 (!pending_state_.item->HasSubmenu() || |
| 2134 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2140 !pending_state_.item->GetSubmenu()->IsShowing())) { |
| 2135 // On exit if the user hasn't selected an item with a submenu, move the | 2141 // On exit if the user hasn't selected an item with a submenu, move the |
| 2136 // selection back to the parent menu item. | 2142 // selection back to the parent menu item. |
| 2137 SetSelection(pending_state_.item->GetParentMenuItem(), | 2143 SetSelection(pending_state_.item->GetParentMenuItem(), |
| 2138 SELECTION_OPEN_SUBMENU); | 2144 SELECTION_OPEN_SUBMENU); |
| 2139 } | 2145 } |
| 2140 } | 2146 } |
| 2141 | 2147 |
| 2142 } // namespace views | 2148 } // namespace views |
| OLD | NEW |