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