| 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_INTERFACE_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" |
| 10 #include "ui/views/controls/menu/menu_runner.h" | 11 #include "ui/views/controls/menu/menu_runner.h" |
| 11 | 12 |
| 12 namespace views { | 13 namespace views { |
| 13 | 14 |
| 14 class MenuItemView; | 15 class MenuItemView; |
| 15 | 16 |
| 16 namespace internal { | 17 namespace internal { |
| 17 | 18 |
| 18 // An abstract interface for menu runner implementations. | 19 // An abstract interface for menu runner implementations. |
| 19 // Invoke Release() to destroy. Release() deletes immediately if the menu isn't | 20 // Invoke Release() to destroy. Release() deletes immediately if the menu isn't |
| 20 // showing. If the menu is showing Release() cancels the menu and when the | 21 // showing. If the menu is showing Release() cancels the menu and when the |
| 21 // nested RunMenuAt() call returns deletes itself and the menu. | 22 // nested RunMenuAt() call returns deletes itself and the menu. |
| 22 class MenuRunnerImplInterface { | 23 class MenuRunnerImplInterface { |
| 23 public: | 24 public: |
| 24 // Creates a concrete instance for running |menu_model|. | 25 // Creates a concrete instance for running |menu_model|. |
| 25 // |run_types| is a bitmask of MenuRunner::RunTypes. | 26 // |run_types| is a bitmask of MenuRunner::RunTypes. |
| 26 static MenuRunnerImplInterface* Create(ui::MenuModel* menu_model, | 27 static MenuRunnerImplInterface* Create( |
| 27 int32_t run_types); | 28 ui::MenuModel* menu_model, |
| 29 int32_t run_types, |
| 30 const base::Closure& on_menu_closed_callback); |
| 28 | 31 |
| 29 // Returns true if we're in a nested message loop running the menu. | 32 // Returns true if we're in a nested message loop running the menu. |
| 30 virtual bool IsRunning() const = 0; | 33 virtual bool IsRunning() const = 0; |
| 31 | 34 |
| 32 // See description above class for details. | 35 // See description above class for details. |
| 33 virtual void Release() = 0; | 36 virtual void Release() = 0; |
| 34 | 37 |
| 35 // Runs the menu. See MenuRunner::RunMenuAt for more details. | 38 // Runs the menu. See MenuRunner::RunMenuAt for more details. |
| 36 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, | 39 virtual MenuRunner::RunResult RunMenuAt(Widget* parent, |
| 37 MenuButton* button, | 40 MenuButton* button, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 | 51 |
| 49 protected: | 52 protected: |
| 50 // Call Release() to delete. | 53 // Call Release() to delete. |
| 51 virtual ~MenuRunnerImplInterface() {} | 54 virtual ~MenuRunnerImplInterface() {} |
| 52 }; | 55 }; |
| 53 | 56 |
| 54 } // namespace internal | 57 } // namespace internal |
| 55 } // namespace views | 58 } // namespace views |
| 56 | 59 |
| 57 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ | 60 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_INTERFACE_H_ |
| OLD | NEW |