OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/menu/menu_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/dragdrop/os_exchange_data.h" | 10 #include "ui/base/dragdrop/os_exchange_data.h" |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 pending_state_.initial_bounds = bounds; | 1010 pending_state_.initial_bounds = bounds; |
1011 if (bounds.height() > 1) { | 1011 if (bounds.height() > 1) { |
1012 // Inset the bounds slightly, otherwise drag coordinates don't line up | 1012 // Inset the bounds slightly, otherwise drag coordinates don't line up |
1013 // nicely and menus close prematurely. | 1013 // nicely and menus close prematurely. |
1014 pending_state_.initial_bounds.Inset(0, 1); | 1014 pending_state_.initial_bounds.Inset(0, 1); |
1015 } | 1015 } |
1016 pending_state_.anchor = position; | 1016 pending_state_.anchor = position; |
1017 | 1017 |
1018 // Calculate the bounds of the monitor we'll show menus on. Do this once to | 1018 // Calculate the bounds of the monitor we'll show menus on. Do this once to |
1019 // avoid repeated system queries for the info. | 1019 // avoid repeated system queries for the info. |
1020 pending_state_.monitor_bounds = Screen::GetMonitorAreaNearestPoint( | 1020 pending_state_.monitor_bounds = Screen::GetMonitorWorkAreaNearestPoint( |
1021 bounds.origin()); | 1021 bounds.origin()); |
1022 } | 1022 } |
1023 | 1023 |
1024 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { | 1024 void MenuController::Accept(MenuItemView* item, int mouse_event_flags) { |
1025 DCHECK(IsBlockingRun()); | 1025 DCHECK(IsBlockingRun()); |
1026 result_ = item; | 1026 result_ = item; |
1027 if (item && !menu_stack_.empty() && | 1027 if (item && !menu_stack_.empty() && |
1028 !item->GetDelegate()->ShouldCloseAllMenusOnExecute(item->GetCommand())) { | 1028 !item->GetDelegate()->ShouldCloseAllMenusOnExecute(item->GetCommand())) { |
1029 exit_type_ = EXIT_OUTERMOST; | 1029 exit_type_ = EXIT_OUTERMOST; |
1030 } else { | 1030 } else { |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 return; | 1845 return; |
1846 | 1846 |
1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if | 1847 // Reset the active_mouse_view_ before sending mouse capture lost. That way if |
1848 // it calls back to us, we aren't in a weird state. | 1848 // it calls back to us, we aren't in a weird state. |
1849 View* active_view = active_mouse_view_; | 1849 View* active_view = active_mouse_view_; |
1850 active_mouse_view_ = NULL; | 1850 active_mouse_view_ = NULL; |
1851 active_view->OnMouseCaptureLost(); | 1851 active_view->OnMouseCaptureLost(); |
1852 } | 1852 } |
1853 | 1853 |
1854 } // namespace views | 1854 } // namespace views |
OLD | NEW |