| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RUNNER_IMPL_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
| 7 | 7 |
| 8 #include "ui/views/controls/menu/menu_runner_impl_interface.h" | 8 #include "ui/views/controls/menu/menu_runner_impl_interface.h" |
| 9 | 9 |
| 10 #include <stdint.h> |
| 11 |
| 10 #include <set> | 12 #include <set> |
| 11 | 13 |
| 14 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 13 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 14 #include "ui/views/controls/menu/menu_controller_delegate.h" | 17 #include "ui/views/controls/menu/menu_controller_delegate.h" |
| 15 | 18 |
| 16 namespace views { | 19 namespace views { |
| 17 | 20 |
| 18 class MenuController; | 21 class MenuController; |
| 19 class MenuDelegate; | 22 class MenuDelegate; |
| 20 class MenuItemView; | 23 class MenuItemView; |
| 21 | 24 |
| 22 namespace internal { | 25 namespace internal { |
| 23 | 26 |
| 24 // A menu runner implementation that uses views::MenuItemView to show a menu. | 27 // A menu runner implementation that uses views::MenuItemView to show a menu. |
| 25 class MenuRunnerImpl : public MenuRunnerImplInterface, | 28 class MenuRunnerImpl : public MenuRunnerImplInterface, |
| 26 public MenuControllerDelegate { | 29 public MenuControllerDelegate { |
| 27 public: | 30 public: |
| 28 explicit MenuRunnerImpl(MenuItemView* menu); | 31 explicit MenuRunnerImpl(MenuItemView* menu); |
| 29 | 32 |
| 30 bool IsRunning() const override; | 33 bool IsRunning() const override; |
| 31 void Release() override; | 34 void Release() override; |
| 32 MenuRunner::RunResult RunMenuAt(Widget* parent, | 35 MenuRunner::RunResult RunMenuAt(Widget* parent, |
| 33 MenuButton* button, | 36 MenuButton* button, |
| 34 const gfx::Rect& bounds, | 37 const gfx::Rect& bounds, |
| 35 MenuAnchorPosition anchor, | 38 MenuAnchorPosition anchor, |
| 36 int32 run_types) override; | 39 int32_t run_types) override; |
| 37 void Cancel() override; | 40 void Cancel() override; |
| 38 base::TimeDelta GetClosingEventTime() const override; | 41 base::TimeDelta GetClosingEventTime() const override; |
| 39 | 42 |
| 40 // MenuControllerDelegate: | 43 // MenuControllerDelegate: |
| 41 void OnMenuClosed(NotifyType type, | 44 void OnMenuClosed(NotifyType type, |
| 42 MenuItemView* menu, | 45 MenuItemView* menu, |
| 43 int mouse_event_flags) override; | 46 int mouse_event_flags) override; |
| 44 void SiblingMenuCreated(MenuItemView* menu) override; | 47 void SiblingMenuCreated(MenuItemView* menu) override; |
| 45 | 48 |
| 46 private: | 49 private: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Used to detect deletion of |this| when notifying delegate of success. | 95 // Used to detect deletion of |this| when notifying delegate of success. |
| 93 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; | 96 base::WeakPtrFactory<MenuRunnerImpl> weak_factory_; |
| 94 | 97 |
| 95 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); | 98 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImpl); |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 } // namespace internal | 101 } // namespace internal |
| 99 } // namespace views | 102 } // namespace views |
| 100 | 103 |
| 101 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ | 104 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_H_ |
| OLD | NEW |