OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/menu/menu_host.h" | 5 #include "ui/views/controls/menu/menu_host.h" |
6 | 6 |
7 #include "ui/views/controls/menu/menu_controller.h" | 7 #include "ui/views/controls/menu/menu_controller.h" |
8 #include "ui/views/controls/menu/menu_host_root_view.h" | 8 #include "ui/views/controls/menu/menu_host_root_view.h" |
9 #include "ui/views/controls/menu/menu_item_view.h" | 9 #include "ui/views/controls/menu/menu_item_view.h" |
10 #include "ui/views/controls/menu/native_menu_host.h" | 10 #include "ui/views/controls/menu/native_menu_host.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 if (!destroying_) { | 102 if (!destroying_) { |
103 // We weren't explicitly told to destroy ourselves, which means the menu was | 103 // We weren't explicitly told to destroy ourselves, which means the menu was |
104 // deleted out from under us (the window we're parented to was closed). Tell | 104 // deleted out from under us (the window we're parented to was closed). Tell |
105 // the SubmenuView to drop references to us. | 105 // the SubmenuView to drop references to us. |
106 submenu_->MenuHostDestroyed(); | 106 submenu_->MenuHostDestroyed(); |
107 } | 107 } |
108 Widget::OnNativeWidgetDestroyed(); | 108 Widget::OnNativeWidgetDestroyed(); |
109 } | 109 } |
110 | 110 |
111 void MenuHost::OnOwnerClosing() { | 111 void MenuHost::OnOwnerClosing() { |
| 112 if (destroying_) |
| 113 return; |
| 114 |
112 MenuController* menu_controller = | 115 MenuController* menu_controller = |
113 submenu_->GetMenuItem()->GetMenuController(); | 116 submenu_->GetMenuItem()->GetMenuController(); |
114 if (menu_controller && !menu_controller->drag_in_progress()) | 117 if (menu_controller && !menu_controller->drag_in_progress()) |
115 menu_controller->CancelAll(); | 118 menu_controller->CancelAll(); |
116 } | 119 } |
117 | 120 |
118 } // namespace views | 121 } // namespace views |
OLD | NEW |