| 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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 size_t current_size = current_path.size(); | 751 size_t current_size = current_path.size(); |
| 752 size_t new_size = new_path.size(); | 752 size_t new_size = new_path.size(); |
| 753 | 753 |
| 754 if (pending_state_.item != menu_item && pending_state_.item) { | 754 if (pending_state_.item != menu_item && pending_state_.item) { |
| 755 View* current_hot_view = GetFirstHotTrackedView(pending_state_.item); | 755 View* current_hot_view = GetFirstHotTrackedView(pending_state_.item); |
| 756 if (current_hot_view) | 756 if (current_hot_view) |
| 757 current_hot_view->SetHotTracked(false); | 757 current_hot_view->SetHotTracked(false); |
| 758 } | 758 } |
| 759 | 759 |
| 760 // Notify the old path it isn't selected. | 760 // Notify the old path it isn't selected. |
| 761 for (size_t i = paths_differ_at; i < current_size; ++i) | 761 MenuDelegate* current_delegate = |
| 762 current_path.empty() ? NULL : current_path.front()->GetDelegate(); |
| 763 for (size_t i = paths_differ_at; i < current_size; ++i) { |
| 764 if (current_delegate && |
| 765 current_path[i]->GetType() == MenuItemView::SUBMENU) { |
| 766 current_delegate->WillHideMenu(current_path[i]); |
| 767 } |
| 762 current_path[i]->SetSelected(false); | 768 current_path[i]->SetSelected(false); |
| 769 } |
| 763 | 770 |
| 764 // Notify the new path it is selected. | 771 // Notify the new path it is selected. |
| 765 for (size_t i = paths_differ_at; i < new_size; ++i) | 772 for (size_t i = paths_differ_at; i < new_size; ++i) |
| 766 new_path[i]->SetSelected(true); | 773 new_path[i]->SetSelected(true); |
| 767 | 774 |
| 768 if (menu_item && menu_item->GetDelegate()) | 775 if (menu_item && menu_item->GetDelegate()) |
| 769 menu_item->GetDelegate()->SelectionChanged(menu_item); | 776 menu_item->GetDelegate()->SelectionChanged(menu_item); |
| 770 | 777 |
| 771 DCHECK(menu_item || (selection_types & SELECTION_EXIT) != 0); | 778 DCHECK(menu_item || (selection_types & SELECTION_EXIT) != 0); |
| 772 | 779 |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 return; | 1869 return; |
| 1863 | 1870 |
| 1864 // Reset the active_mouse_view_ before sending mouse capture lost. That way if | 1871 // Reset the active_mouse_view_ before sending mouse capture lost. That way if |
| 1865 // it calls back to us, we aren't in a weird state. | 1872 // it calls back to us, we aren't in a weird state. |
| 1866 View* active_view = active_mouse_view_; | 1873 View* active_view = active_mouse_view_; |
| 1867 active_mouse_view_ = NULL; | 1874 active_mouse_view_ = NULL; |
| 1868 active_view->OnMouseCaptureLost(); | 1875 active_view->OnMouseCaptureLost(); |
| 1869 } | 1876 } |
| 1870 | 1877 |
| 1871 } // namespace views | 1878 } // namespace views |
| OLD | NEW |