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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 ReleaseMenuHostCapture(); | 85 ReleaseMenuHostCapture(); |
86 Hide(); | 86 Hide(); |
87 ignore_capture_lost_ = false; | 87 ignore_capture_lost_ = false; |
88 } | 88 } |
89 | 89 |
90 void MenuHost::DestroyMenuHost() { | 90 void MenuHost::DestroyMenuHost() { |
91 HideMenuHost(); | 91 HideMenuHost(); |
92 destroying_ = true; | 92 destroying_ = true; |
93 static_cast<MenuHostRootView*>(GetRootView())->ClearSubmenu(); | 93 static_cast<MenuHostRootView*>(GetRootView())->ClearSubmenu(); |
94 Close(); | 94 Close(); |
95 // Since |submenu_| is not a child view it is necessary to notify its | |
96 // observers so that they can clean up the foucs and drag and drop state. | |
97 View::ViewHierarchyChangedDetails details(false, NULL, submenu_, NULL); | |
98 ViewHierarchyChanged(details); | |
sadrul
2014/03/26 18:01:07
Can this be separated out in a different CL with c
varkha
2014/03/27 04:48:13
See https://codereview.chromium.org/214083004/.
| |
95 } | 99 } |
96 | 100 |
97 void MenuHost::SetMenuHostBounds(const gfx::Rect& bounds) { | 101 void MenuHost::SetMenuHostBounds(const gfx::Rect& bounds) { |
98 SetBounds(bounds); | 102 SetBounds(bounds); |
99 } | 103 } |
100 | 104 |
101 void MenuHost::ReleaseMenuHostCapture() { | 105 void MenuHost::ReleaseMenuHostCapture() { |
102 if (native_widget_private()->HasCapture()) | 106 if (native_widget_private()->HasCapture()) |
103 native_widget_private()->ReleaseCapture(); | 107 native_widget_private()->ReleaseCapture(); |
104 } | 108 } |
(...skipping 29 matching lines...) Expand all Loading... | |
134 if (destroying_) | 138 if (destroying_) |
135 return; | 139 return; |
136 | 140 |
137 MenuController* menu_controller = | 141 MenuController* menu_controller = |
138 submenu_->GetMenuItem()->GetMenuController(); | 142 submenu_->GetMenuItem()->GetMenuController(); |
139 if (menu_controller && !menu_controller->drag_in_progress()) | 143 if (menu_controller && !menu_controller->drag_in_progress()) |
140 menu_controller->CancelAll(); | 144 menu_controller->CancelAll(); |
141 } | 145 } |
142 | 146 |
143 } // namespace views | 147 } // namespace views |
OLD | NEW |