| 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 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 11 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 12 | 13 |
| 13 namespace views { | 14 namespace views { |
| 14 | 15 |
| 15 class NativeWidget; | 16 class NativeWidget; |
| 16 class SubmenuView; | 17 class SubmenuView; |
| 17 class View; | 18 class View; |
| 18 class Widget; | 19 class Widget; |
| 19 | 20 |
| 21 namespace internal { |
| 22 |
| 23 // This class is internal to views. |
| 24 class PreMenuEventDispatchHandler; |
| 25 |
| 26 } // internal |
| 27 |
| 20 // SubmenuView uses a MenuHost to house the SubmenuView. | 28 // SubmenuView uses a MenuHost to house the SubmenuView. |
| 21 // | 29 // |
| 22 // SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost | 30 // SubmenuView owns the MenuHost. When SubmenuView is done with the MenuHost |
| 23 // |DestroyMenuHost| is invoked. The one exception to this is if the native | 31 // |DestroyMenuHost| is invoked. The one exception to this is if the native |
| 24 // OS destroys the widget out from under us, in which case |MenuHostDestroyed| | 32 // OS destroys the widget out from under us, in which case |MenuHostDestroyed| |
| 25 // is invoked back on the SubmenuView and the SubmenuView then drops references | 33 // is invoked back on the SubmenuView and the SubmenuView then drops references |
| 26 // to the MenuHost. | 34 // to the MenuHost. |
| 27 class MenuHost : public Widget { | 35 class MenuHost : public Widget { |
| 28 public: | 36 public: |
| 29 explicit MenuHost(SubmenuView* submenu); | 37 explicit MenuHost(SubmenuView* submenu); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 74 |
| 67 // The view we contain. | 75 // The view we contain. |
| 68 SubmenuView* submenu_; | 76 SubmenuView* submenu_; |
| 69 | 77 |
| 70 // If true, DestroyMenuHost has been invoked. | 78 // If true, DestroyMenuHost has been invoked. |
| 71 bool destroying_; | 79 bool destroying_; |
| 72 | 80 |
| 73 // If true and capture is lost we don't notify the delegate. | 81 // If true and capture is lost we don't notify the delegate. |
| 74 bool ignore_capture_lost_; | 82 bool ignore_capture_lost_; |
| 75 | 83 |
| 84 #if !defined(OS_MACOSX) |
| 85 // Handles raw touch events at the moment. |
| 86 scoped_ptr<internal::PreMenuEventDispatchHandler> pre_dispatch_handler_; |
| 87 #endif |
| 88 |
| 76 DISALLOW_COPY_AND_ASSIGN(MenuHost); | 89 DISALLOW_COPY_AND_ASSIGN(MenuHost); |
| 77 }; | 90 }; |
| 78 | 91 |
| 79 } // namespace views | 92 } // namespace views |
| 80 | 93 |
| 81 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ | 94 #endif // UI_VIEWS_CONTROLS_MENU_MENU_HOST_H_ |
| OLD | NEW |