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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "ui/events/gestures/gesture_recognizer.h" | 9 #include "ui/events/gestures/gesture_recognizer.h" |
10 #include "ui/gfx/path.h" | 10 #include "ui/gfx/path.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 internal::RootView* MenuHost::CreateRootView() { | 104 internal::RootView* MenuHost::CreateRootView() { |
105 return new MenuHostRootView(this, submenu_); | 105 return new MenuHostRootView(this, submenu_); |
106 } | 106 } |
107 | 107 |
108 void MenuHost::OnMouseCaptureLost() { | 108 void MenuHost::OnMouseCaptureLost() { |
109 if (destroying_ || ignore_capture_lost_) | 109 if (destroying_ || ignore_capture_lost_) |
110 return; | 110 return; |
111 MenuController* menu_controller = | 111 MenuController* menu_controller = |
112 submenu_->GetMenuItem()->GetMenuController(); | 112 submenu_->GetMenuItem()->GetMenuController(); |
113 if (menu_controller && !menu_controller->drag_in_progress()) | 113 if (menu_controller && |
| 114 !menu_controller->drag_in_progress() && |
| 115 !child_drag_in_progress()) { |
114 menu_controller->CancelAll(); | 116 menu_controller->CancelAll(); |
| 117 } |
115 Widget::OnMouseCaptureLost(); | 118 Widget::OnMouseCaptureLost(); |
116 } | 119 } |
117 | 120 |
118 void MenuHost::OnNativeWidgetDestroyed() { | 121 void MenuHost::OnNativeWidgetDestroyed() { |
119 if (!destroying_) { | 122 if (!destroying_) { |
120 // We weren't explicitly told to destroy ourselves, which means the menu was | 123 // We weren't explicitly told to destroy ourselves, which means the menu was |
121 // deleted out from under us (the window we're parented to was closed). Tell | 124 // deleted out from under us (the window we're parented to was closed). Tell |
122 // the SubmenuView to drop references to us. | 125 // the SubmenuView to drop references to us. |
123 submenu_->MenuHostDestroyed(); | 126 submenu_->MenuHostDestroyed(); |
124 } | 127 } |
125 Widget::OnNativeWidgetDestroyed(); | 128 Widget::OnNativeWidgetDestroyed(); |
126 } | 129 } |
127 | 130 |
128 void MenuHost::OnOwnerClosing() { | 131 void MenuHost::OnOwnerClosing() { |
129 if (destroying_) | 132 if (destroying_) |
130 return; | 133 return; |
131 | 134 |
132 MenuController* menu_controller = | 135 MenuController* menu_controller = |
133 submenu_->GetMenuItem()->GetMenuController(); | 136 submenu_->GetMenuItem()->GetMenuController(); |
134 if (menu_controller && !menu_controller->drag_in_progress()) | 137 if (menu_controller && !menu_controller->drag_in_progress()) |
135 menu_controller->CancelAll(); | 138 menu_controller->CancelAll(); |
136 } | 139 } |
137 | 140 |
138 } // namespace views | 141 } // namespace views |
OLD | NEW |