| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 void MenuHost::ShowMenuHost(bool do_capture) { | 67 void MenuHost::ShowMenuHost(bool do_capture) { |
| 68 // Doing a capture may make us get capture lost. Ignore it while we're in the | 68 // Doing a capture may make us get capture lost. Ignore it while we're in the |
| 69 // process of showing. | 69 // process of showing. |
| 70 base::AutoReset<bool> reseter(&ignore_capture_lost_, true); | 70 base::AutoReset<bool> reseter(&ignore_capture_lost_, true); |
| 71 ShowInactive(); | 71 ShowInactive(); |
| 72 if (do_capture) { | 72 if (do_capture) { |
| 73 // Cancel existing touches, so we don't miss some touch release/cancel | 73 // Cancel existing touches, so we don't miss some touch release/cancel |
| 74 // events due to the menu taking capture. | 74 // events due to the menu taking capture. |
| 75 #if defined(USE_AURA) |
| 75 ui::GestureRecognizer::Get()->TransferEventsTo(NULL, NULL); | 76 ui::GestureRecognizer::Get()->TransferEventsTo(NULL, NULL); |
| 77 #endif |
| 76 native_widget_private()->SetCapture(); | 78 native_widget_private()->SetCapture(); |
| 77 } | 79 } |
| 78 } | 80 } |
| 79 | 81 |
| 80 void MenuHost::HideMenuHost() { | 82 void MenuHost::HideMenuHost() { |
| 81 ignore_capture_lost_ = true; | 83 ignore_capture_lost_ = true; |
| 82 ReleaseMenuHostCapture(); | 84 ReleaseMenuHostCapture(); |
| 83 Hide(); | 85 Hide(); |
| 84 ignore_capture_lost_ = false; | 86 ignore_capture_lost_ = false; |
| 85 } | 87 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (destroying_) | 133 if (destroying_) |
| 132 return; | 134 return; |
| 133 | 135 |
| 134 MenuController* menu_controller = | 136 MenuController* menu_controller = |
| 135 submenu_->GetMenuItem()->GetMenuController(); | 137 submenu_->GetMenuItem()->GetMenuController(); |
| 136 if (menu_controller && !menu_controller->drag_in_progress()) | 138 if (menu_controller && !menu_controller->drag_in_progress()) |
| 137 menu_controller->CancelAll(); | 139 menu_controller->CancelAll(); |
| 138 } | 140 } |
| 139 | 141 |
| 140 } // namespace views | 142 } // namespace views |
| OLD | NEW |