Chromium Code Reviews| 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 focus and drag and drop state. | |
| 97 View::ViewHierarchyChangedDetails details(false, NULL, submenu_, NULL); | |
| 98 ViewHierarchyChanged(details); | |
|
sky
2014/03/27 21:40:43
I think this is a deficiency in how focus is clean
varkha
2014/03/27 22:05:10
In this case the menu does not have focus (the men
sky
2014/03/27 23:31:28
Isn't this happening because SubmenuView is client
| |
| 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 |