Chromium Code Reviews| 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 // of the menus from the last run. | 927 // of the menus from the last run. |
| 928 gfx::Point screen_loc(event.location()); | 928 gfx::Point screen_loc(event.location()); |
| 929 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); | 929 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); |
| 930 MenuPart last_part = GetMenuPartByScreenCoordinateUsingMenu( | 930 MenuPart last_part = GetMenuPartByScreenCoordinateUsingMenu( |
| 931 menu_stack_.back().item, screen_loc); | 931 menu_stack_.back().item, screen_loc); |
| 932 if (last_part.type != MenuPart::NONE) | 932 if (last_part.type != MenuPart::NONE) |
| 933 exit_type = EXIT_OUTERMOST; | 933 exit_type = EXIT_OUTERMOST; |
| 934 } | 934 } |
| 935 Cancel(exit_type); | 935 Cancel(exit_type); |
| 936 | 936 |
| 937 #if !defined(OS_WIN) | 937 #if defined(OS_CHROMEOS) |
| 938 // We're going to exit the menu and want to repost the event so that is | 938 // We're going to exit the menu and want to repost the event so that is |
| 939 // is handled normally after the context menu has exited. We call | 939 // is handled normally after the context menu has exited. We call |
| 940 // RepostEvent after Cancel so that mouse capture has been released so | 940 // RepostEvent after Cancel so that mouse capture has been released so |
| 941 // that finding the event target is unaffected by the current capture. | 941 // that finding the event target is unaffected by the current capture. |
| 942 RepostEvent(source, event); | 942 RepostEvent(source, event); |
| 943 #endif | 943 #endif |
| 944 // Do not repost events for Linux Aura. | |
|
sky
2014/03/19 15:36:15
Can you document why we don't need to repost?
| |
| 944 | 945 |
|
sky
2014/03/19 15:36:15
nit: remove this empty line.
| |
| 945 return; | 946 return; |
| 946 } | 947 } |
| 947 | 948 |
| 948 // On a press we immediately commit the selection, that way a submenu | 949 // On a press we immediately commit the selection, that way a submenu |
| 949 // pops up immediately rather than after a delay. | 950 // pops up immediately rather than after a delay. |
| 950 int selection_types = SELECTION_UPDATE_IMMEDIATELY; | 951 int selection_types = SELECTION_UPDATE_IMMEDIATELY; |
| 951 if (!part.menu) { | 952 if (!part.menu) { |
| 952 part.menu = part.parent; | 953 part.menu = part.parent; |
| 953 selection_types |= SELECTION_OPEN_SUBMENU; | 954 selection_types |= SELECTION_OPEN_SUBMENU; |
| 954 } else { | 955 } else { |
| (...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2346 (!pending_state_.item->HasSubmenu() || | 2347 (!pending_state_.item->HasSubmenu() || |
| 2347 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2348 !pending_state_.item->GetSubmenu()->IsShowing())) { |
| 2348 // On exit if the user hasn't selected an item with a submenu, move the | 2349 // On exit if the user hasn't selected an item with a submenu, move the |
| 2349 // selection back to the parent menu item. | 2350 // selection back to the parent menu item. |
| 2350 SetSelection(pending_state_.item->GetParentMenuItem(), | 2351 SetSelection(pending_state_.item->GetParentMenuItem(), |
| 2351 SELECTION_OPEN_SUBMENU); | 2352 SELECTION_OPEN_SUBMENU); |
| 2352 } | 2353 } |
| 2353 } | 2354 } |
| 2354 | 2355 |
| 2355 } // namespace views | 2356 } // namespace views |
| OLD | NEW |