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/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/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 } | 1741 } |
1742 | 1742 |
1743 // If no mnemonics found, look at first character of titles. | 1743 // If no mnemonics found, look at first character of titles. |
1744 details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic); | 1744 details = FindChildForMnemonic(item, key, &TitleMatchesMnemonic); |
1745 if (details.first_match != -1) | 1745 if (details.first_match != -1) |
1746 return AcceptOrSelect(item, details); | 1746 return AcceptOrSelect(item, details); |
1747 | 1747 |
1748 return false; | 1748 return false; |
1749 } | 1749 } |
1750 | 1750 |
1751 #if defined(OS_WIN) && !defined(USE_AURA) | 1751 #if defined(OS_WIN) |
| 1752 #if defined(USE_AURA) |
| 1753 void MenuController::RepostEvent(SubmenuView* source, |
| 1754 const MouseEvent& event) { |
| 1755 } |
| 1756 #else |
1752 void MenuController::RepostEvent(SubmenuView* source, | 1757 void MenuController::RepostEvent(SubmenuView* source, |
1753 const MouseEvent& event) { | 1758 const MouseEvent& event) { |
1754 if (!state_.item) { | 1759 if (!state_.item) { |
1755 // We some times get an event after closing all the menus. Ignore it. | 1760 // We some times get an event after closing all the menus. Ignore it. |
1756 // Make sure the menu is in fact not visible. If the menu is visible, then | 1761 // Make sure the menu is in fact not visible. If the menu is visible, then |
1757 // we're in a bad state where we think the menu isn't visibile but it is. | 1762 // we're in a bad state where we think the menu isn't visibile but it is. |
1758 DCHECK(!source->GetWidget()->IsVisible()); | 1763 DCHECK(!source->GetWidget()->IsVisible()); |
1759 return; | 1764 return; |
1760 } | 1765 } |
1761 | 1766 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 if (in_client_area) { | 1813 if (in_client_area) { |
1809 PostMessage(window, event_type, event.GetWindowsFlags(), | 1814 PostMessage(window, event_type, event.GetWindowsFlags(), |
1810 MAKELPARAM(window_x, window_y)); | 1815 MAKELPARAM(window_x, window_y)); |
1811 } else { | 1816 } else { |
1812 PostMessage(window, event_type, nc_hit_result, | 1817 PostMessage(window, event_type, nc_hit_result, |
1813 MAKELPARAM(screen_loc.x(), screen_loc.y())); | 1818 MAKELPARAM(screen_loc.x(), screen_loc.y())); |
1814 } | 1819 } |
1815 } | 1820 } |
1816 } | 1821 } |
1817 } | 1822 } |
1818 #endif | 1823 #endif // !defined(USE_AURA) |
| 1824 #endif // defined(OS_WIN) |
1819 | 1825 |
1820 void MenuController::SetDropMenuItem( | 1826 void MenuController::SetDropMenuItem( |
1821 MenuItemView* new_target, | 1827 MenuItemView* new_target, |
1822 MenuDelegate::DropPosition new_position) { | 1828 MenuDelegate::DropPosition new_position) { |
1823 if (new_target == drop_target_ && new_position == drop_position_) | 1829 if (new_target == drop_target_ && new_position == drop_position_) |
1824 return; | 1830 return; |
1825 | 1831 |
1826 if (drop_target_) { | 1832 if (drop_target_) { |
1827 drop_target_->GetParentMenuItem()->GetSubmenu()->SetDropMenuItem( | 1833 drop_target_->GetParentMenuItem()->GetSubmenu()->SetDropMenuItem( |
1828 NULL, MenuDelegate::DROP_NONE); | 1834 NULL, MenuDelegate::DROP_NONE); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1915 return; | 1921 return; |
1916 | 1922 |
1917 // Reset the active_mouse_view_ before sending mouse capture lost. That way if | 1923 // Reset the active_mouse_view_ before sending mouse capture lost. That way if |
1918 // it calls back to us, we aren't in a weird state. | 1924 // it calls back to us, we aren't in a weird state. |
1919 View* active_view = active_mouse_view_; | 1925 View* active_view = active_mouse_view_; |
1920 active_mouse_view_ = NULL; | 1926 active_mouse_view_ = NULL; |
1921 active_view->OnMouseCaptureLost(); | 1927 active_view->OnMouseCaptureLost(); |
1922 } | 1928 } |
1923 | 1929 |
1924 } // namespace views | 1930 } // namespace views |
OLD | NEW |