OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "gfx/canvas_skia.h" | 10 #include "gfx/canvas_skia.h" |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 for (size_t i = paths_differ_at; i < current_size; ++i) | 738 for (size_t i = paths_differ_at; i < current_size; ++i) |
739 current_path[i]->SetSelected(false); | 739 current_path[i]->SetSelected(false); |
740 | 740 |
741 // Notify the new path it is selected. | 741 // Notify the new path it is selected. |
742 for (size_t i = paths_differ_at; i < new_size; ++i) | 742 for (size_t i = paths_differ_at; i < new_size; ++i) |
743 new_path[i]->SetSelected(true); | 743 new_path[i]->SetSelected(true); |
744 | 744 |
745 if (menu_item && menu_item->GetDelegate()) | 745 if (menu_item && menu_item->GetDelegate()) |
746 menu_item->GetDelegate()->SelectionChanged(menu_item); | 746 menu_item->GetDelegate()->SelectionChanged(menu_item); |
747 | 747 |
748 CHECK(menu_item || (selection_types & SELECTION_EXIT) != 0); | 748 DCHECK(menu_item || (selection_types & SELECTION_EXIT) != 0); |
749 | 749 |
750 pending_state_.item = menu_item; | 750 pending_state_.item = menu_item; |
751 pending_state_.submenu_open = (selection_types & SELECTION_OPEN_SUBMENU) != 0; | 751 pending_state_.submenu_open = (selection_types & SELECTION_OPEN_SUBMENU) != 0; |
752 | 752 |
753 // Stop timers. | 753 // Stop timers. |
754 StopShowTimer(); | 754 StopShowTimer(); |
755 StopCancelAllTimer(); | 755 StopCancelAllTimer(); |
756 | 756 |
757 if (selection_types & SELECTION_UPDATE_IMMEDIATELY) | 757 if (selection_types & SELECTION_UPDATE_IMMEDIATELY) |
758 CommitPendingSelection(); | 758 CommitPendingSelection(); |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 return false; | 1661 return false; |
1662 } | 1662 } |
1663 | 1663 |
1664 #if defined(OS_WIN) | 1664 #if defined(OS_WIN) |
1665 void MenuController::RepostEvent(SubmenuView* source, | 1665 void MenuController::RepostEvent(SubmenuView* source, |
1666 const MouseEvent& event) { | 1666 const MouseEvent& event) { |
1667 if (!state_.item) { | 1667 if (!state_.item) { |
1668 // We some times get an event after closing all the menus. Ignore it. | 1668 // We some times get an event after closing all the menus. Ignore it. |
1669 // Make sure the menu is in fact not visible. If the menu is visible, then | 1669 // Make sure the menu is in fact not visible. If the menu is visible, then |
1670 // we're in a bad state where we think the menu isn't visibile but it is. | 1670 // we're in a bad state where we think the menu isn't visibile but it is. |
1671 CHECK(!source->GetWidget()->IsVisible()); | 1671 DCHECK(!source->GetWidget()->IsVisible()); |
1672 return; | 1672 return; |
1673 } | 1673 } |
1674 | 1674 |
1675 gfx::Point screen_loc(event.location()); | 1675 gfx::Point screen_loc(event.location()); |
1676 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); | 1676 View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); |
1677 HWND window = WindowFromPoint(screen_loc.ToPOINT()); | 1677 HWND window = WindowFromPoint(screen_loc.ToPOINT()); |
1678 if (window) { | 1678 if (window) { |
1679 // Release the capture. | 1679 // Release the capture. |
1680 SubmenuView* submenu = state_.item->GetRootMenuItem()->GetSubmenu(); | 1680 SubmenuView* submenu = state_.item->GetRootMenuItem()->GetSubmenu(); |
1681 submenu->ReleaseCapture(); | 1681 submenu->ReleaseCapture(); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1836 | 1836 |
1837 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); | 1837 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); |
1838 // Reset the active_mouse_view_ before sending mouse released. That way if if | 1838 // Reset the active_mouse_view_ before sending mouse released. That way if if |
1839 // calls back to use we aren't in a weird state. | 1839 // calls back to use we aren't in a weird state. |
1840 View* active_view = active_mouse_view_; | 1840 View* active_view = active_mouse_view_; |
1841 active_mouse_view_ = NULL; | 1841 active_mouse_view_ = NULL; |
1842 active_view->OnMouseReleased(release_event, true); | 1842 active_view->OnMouseReleased(release_event, true); |
1843 } | 1843 } |
1844 | 1844 |
1845 } // namespace views | 1845 } // namespace views |
OLD | NEW |