| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" |
| 17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 18 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
| 19 #include "ui/events/event_constants.h" | 20 #include "ui/events/event_constants.h" |
| 20 #include "ui/events/platform/platform_event_dispatcher.h" | 21 #include "ui/events/platform/platform_event_dispatcher.h" |
| 21 #include "ui/views/controls/button/menu_button.h" | 22 #include "ui/views/controls/button/menu_button.h" |
| 22 #include "ui/views/controls/menu/menu_config.h" | 23 #include "ui/views/controls/menu/menu_config.h" |
| 23 #include "ui/views/controls/menu/menu_delegate.h" | 24 #include "ui/views/controls/menu/menu_delegate.h" |
| 24 #include "ui/views/widget/widget_observer.h" | 25 #include "ui/views/widget/widget_observer.h" |
| 25 | 26 |
| 26 namespace base { | 27 namespace base { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // Sets/gets the active mouse view. See UpdateActiveMouseView() for details. | 533 // Sets/gets the active mouse view. See UpdateActiveMouseView() for details. |
| 533 void SetActiveMouseView(View* view); | 534 void SetActiveMouseView(View* view); |
| 534 View* GetActiveMouseView(); | 535 View* GetActiveMouseView(); |
| 535 | 536 |
| 536 // Sets exit type. Calling this can terminate the active nested message-loop. | 537 // Sets exit type. Calling this can terminate the active nested message-loop. |
| 537 void SetExitType(ExitType type); | 538 void SetExitType(ExitType type); |
| 538 | 539 |
| 539 // Terminates the current nested message-loop. | 540 // Terminates the current nested message-loop. |
| 540 void TerminateNestedMessageLoop(); | 541 void TerminateNestedMessageLoop(); |
| 541 | 542 |
| 543 // Performs the teardown of menus launched with |async_run_|. This will |
| 544 // notifiy the |delegate_|. If |exit_type_| is EXIT_ALL all nested |
| 545 // asynchronous runs will be exited. |
| 546 void ExitAsyncRun(); |
| 547 |
| 542 // Performs the teardown of the menu launched by Run(). The selected item is | 548 // Performs the teardown of the menu launched by Run(). The selected item is |
| 543 // returned. | 549 // returned. |
| 544 MenuItemView* ExitMenuRun(); | 550 MenuItemView* ExitMenuRun(); |
| 545 | 551 |
| 546 // Handles the mouse location event on the submenu |source|. | 552 // Handles the mouse location event on the submenu |source|. |
| 547 void HandleMouseLocation(SubmenuView* source, | 553 void HandleMouseLocation(SubmenuView* source, |
| 548 const gfx::Point& mouse_location); | 554 const gfx::Point& mouse_location); |
| 549 | 555 |
| 550 // Retrieve an appropriate Screen. | 556 // Retrieve an appropriate Screen. |
| 551 gfx::Screen* GetScreen(); | 557 gfx::Screen* GetScreen(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 // to. We need this, because if we forward one event to it (e.g., mouse | 685 // to. We need this, because if we forward one event to it (e.g., mouse |
| 680 // pressed), subsequent events (like dragging) should also go to it, even if | 686 // pressed), subsequent events (like dragging) should also go to it, even if |
| 681 // the mouse is no longer over the view. | 687 // the mouse is no longer over the view. |
| 682 MenuHostRootView* current_mouse_event_target_; | 688 MenuHostRootView* current_mouse_event_target_; |
| 683 | 689 |
| 684 // A mask of the EventFlags for the mouse buttons currently pressed. | 690 // A mask of the EventFlags for the mouse buttons currently pressed. |
| 685 int current_mouse_pressed_state_; | 691 int current_mouse_pressed_state_; |
| 686 | 692 |
| 687 scoped_ptr<MenuMessageLoop> message_loop_; | 693 scoped_ptr<MenuMessageLoop> message_loop_; |
| 688 | 694 |
| 695 base::WeakPtrFactory<MenuController> weak_factory_; |
| 696 |
| 689 DISALLOW_COPY_AND_ASSIGN(MenuController); | 697 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 690 }; | 698 }; |
| 691 | 699 |
| 692 } // namespace views | 700 } // namespace views |
| 693 | 701 |
| 694 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 702 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |