| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/menu/menu_host.h" | 5 #include "views/controls/menu/menu_host.h" |
| 6 | 6 |
| 7 #include "ui/views/widget/native_widget_private.h" | 7 #include "ui/views/widget/native_widget_private.h" |
| 8 #include "ui/views/widget/widget.h" | 8 #include "ui/views/widget/widget.h" |
| 9 #include "views/controls/menu/menu_controller.h" | 9 #include "views/controls/menu/menu_controller.h" |
| 10 #include "views/controls/menu/menu_host_root_view.h" | 10 #include "views/controls/menu/menu_host_root_view.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 bool MenuHost::IsMenuHostVisible() { | 42 bool MenuHost::IsMenuHostVisible() { |
| 43 return IsVisible(); | 43 return IsVisible(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void MenuHost::ShowMenuHost(bool do_capture) { | 46 void MenuHost::ShowMenuHost(bool do_capture) { |
| 47 // Doing a capture may make us get capture lost. Ignore it while we're in the | 47 // Doing a capture may make us get capture lost. Ignore it while we're in the |
| 48 // process of showing. | 48 // process of showing. |
| 49 ignore_capture_lost_ = true; | 49 ignore_capture_lost_ = true; |
| 50 Show(); | 50 Show(); |
| 51 #if defined(TOUCH_UI) | |
| 52 Activate(); | |
| 53 #endif | |
| 54 if (do_capture) | 51 if (do_capture) |
| 55 native_widget_private()->SetMouseCapture(); | 52 native_widget_private()->SetMouseCapture(); |
| 56 ignore_capture_lost_ = false; | 53 ignore_capture_lost_ = false; |
| 57 } | 54 } |
| 58 | 55 |
| 59 void MenuHost::HideMenuHost() { | 56 void MenuHost::HideMenuHost() { |
| 60 ignore_capture_lost_ = true; | 57 ignore_capture_lost_ = true; |
| 61 ReleaseMenuHostCapture(); | 58 ReleaseMenuHostCapture(); |
| 62 Hide(); | 59 Hide(); |
| 63 ignore_capture_lost_ = false; | 60 ignore_capture_lost_ = false; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (!destroying_) { | 101 if (!destroying_) { |
| 105 // We weren't explicitly told to destroy ourselves, which means the menu was | 102 // We weren't explicitly told to destroy ourselves, which means the menu was |
| 106 // deleted out from under us (the window we're parented to was closed). Tell | 103 // deleted out from under us (the window we're parented to was closed). Tell |
| 107 // the SubmenuView to drop references to us. | 104 // the SubmenuView to drop references to us. |
| 108 submenu_->MenuHostDestroyed(); | 105 submenu_->MenuHostDestroyed(); |
| 109 } | 106 } |
| 110 Widget::OnNativeWidgetDestroyed(); | 107 Widget::OnNativeWidgetDestroyed(); |
| 111 } | 108 } |
| 112 | 109 |
| 113 } // namespace views | 110 } // namespace views |
| OLD | NEW |