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_CONTROLLER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <memory> | 11 #include <memory> |
12 #include <set> | 12 #include <set> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/linked_ptr.h" | |
18 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
19 #include "build/build_config.h" | 18 #include "build/build_config.h" |
20 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
21 #include "ui/events/event_constants.h" | 20 #include "ui/events/event_constants.h" |
22 #include "ui/events/platform/platform_event_dispatcher.h" | 21 #include "ui/events/platform/platform_event_dispatcher.h" |
23 #include "ui/views/controls/button/menu_button.h" | 22 #include "ui/views/controls/button/menu_button.h" |
24 #include "ui/views/controls/menu/menu_config.h" | 23 #include "ui/views/controls/menu/menu_config.h" |
25 #include "ui/views/controls/menu/menu_delegate.h" | 24 #include "ui/views/controls/menu/menu_delegate.h" |
26 #include "ui/views/widget/widget_observer.h" | 25 #include "ui/views/widget/widget_observer.h" |
27 | 26 |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 | 585 |
587 // If the user accepted the selection, this is the result. | 586 // If the user accepted the selection, this is the result. |
588 MenuItemView* result_; | 587 MenuItemView* result_; |
589 | 588 |
590 // The event flags when the user selected the menu. | 589 // The event flags when the user selected the menu. |
591 int accept_event_flags_; | 590 int accept_event_flags_; |
592 | 591 |
593 // If not empty, it means we're nested. When Run is invoked from within | 592 // If not empty, it means we're nested. When Run is invoked from within |
594 // Run, the current state (state_) is pushed onto menu_stack_. This allows | 593 // Run, the current state (state_) is pushed onto menu_stack_. This allows |
595 // MenuController to restore the state when the nested run returns. | 594 // MenuController to restore the state when the nested run returns. |
596 typedef std::pair<State, linked_ptr<MenuButton::PressedLock> > NestedState; | 595 using NestedState = |
| 596 std::pair<State, std::unique_ptr<MenuButton::PressedLock>>; |
597 std::list<NestedState> menu_stack_; | 597 std::list<NestedState> menu_stack_; |
598 | 598 |
599 // When Run is invoked during an active Run, it may be called from a separate | 599 // When Run is invoked during an active Run, it may be called from a separate |
600 // MenuControllerDelegate. If not empty is means we are nested, and the | 600 // MenuControllerDelegate. If not empty is means we are nested, and the |
601 // stacked delegates should be notified instead of |delegate_|. | 601 // stacked delegates should be notified instead of |delegate_|. |
602 typedef std::pair<internal::MenuControllerDelegate*, bool> NestedDelegate; | 602 typedef std::pair<internal::MenuControllerDelegate*, bool> NestedDelegate; |
603 std::list<NestedDelegate> delegate_stack_; | 603 std::list<NestedDelegate> delegate_stack_; |
604 | 604 |
605 // As the mouse moves around submenus are not opened immediately. Instead | 605 // As the mouse moves around submenus are not opened immediately. Instead |
606 // they open after this timer fires. | 606 // they open after this timer fires. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 #if defined(USE_AURA) | 698 #if defined(USE_AURA) |
699 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; | 699 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; |
700 #endif | 700 #endif |
701 | 701 |
702 DISALLOW_COPY_AND_ASSIGN(MenuController); | 702 DISALLOW_COPY_AND_ASSIGN(MenuController); |
703 }; | 703 }; |
704 | 704 |
705 } // namespace views | 705 } // namespace views |
706 | 706 |
707 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 707 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
OLD | NEW |