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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 bool MenuHost::IsMenuHostVisible() { | 71 bool MenuHost::IsMenuHostVisible() { |
72 return IsVisible(); | 72 return IsVisible(); |
73 } | 73 } |
74 | 74 |
75 void MenuHost::ShowMenuHost(bool do_capture) { | 75 void MenuHost::ShowMenuHost(bool do_capture) { |
76 // Doing a capture may make us get capture lost. Ignore it while we're in the | 76 // Doing a capture may make us get capture lost. Ignore it while we're in the |
77 // process of showing. | 77 // process of showing. |
78 base::AutoReset<bool> reseter(&ignore_capture_lost_, true); | 78 base::AutoReset<bool> reseter(&ignore_capture_lost_, true); |
79 Show(); | 79 ShowInactive(); |
80 if (do_capture) { | 80 if (do_capture) { |
81 #if defined(USE_AURA) | 81 #if defined(USE_AURA) |
82 // Cancel existing touches, so we don't miss some touch release/cancel | 82 // Cancel existing touches, so we don't miss some touch release/cancel |
83 // events due to the menu taking capture. | 83 // events due to the menu taking capture. |
84 ui::GestureRecognizer::Get()->TransferEventsTo(GetNativeWindow(), NULL); | 84 ui::GestureRecognizer::Get()->TransferEventsTo(GetNativeWindow(), NULL); |
85 #endif // USE_AURA | 85 #endif // USE_AURA |
86 native_widget_private()->SetCapture(); | 86 native_widget_private()->SetCapture(); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 if (destroying_) | 141 if (destroying_) |
142 return; | 142 return; |
143 | 143 |
144 MenuController* menu_controller = | 144 MenuController* menu_controller = |
145 submenu_->GetMenuItem()->GetMenuController(); | 145 submenu_->GetMenuItem()->GetMenuController(); |
146 if (menu_controller && !menu_controller->drag_in_progress()) | 146 if (menu_controller && !menu_controller->drag_in_progress()) |
147 menu_controller->CancelAll(); | 147 menu_controller->CancelAll(); |
148 } | 148 } |
149 | 149 |
150 } // namespace views | 150 } // namespace views |
OLD | NEW |