Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: ui/views/controls/menu/menu_runner_impl_adapter.h

Issue 2394123002: Views: Expose an on_closed callback via the MenuRunner constructor. (Closed)
Patch Set: default arg Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ADAPTER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "ui/views/controls/menu/menu_runner_impl_interface.h" 11 #include "ui/views/controls/menu/menu_runner_impl_interface.h"
12 #include "ui/views/views_export.h"
12 13
13 namespace views { 14 namespace views {
14 namespace internal { 15 namespace internal {
15 16
16 class MenuRunnerImpl; 17 class MenuRunnerImpl;
17 18
18 // Given a MenuModel, adapts MenuRunnerImpl which expects a MenuItemView. 19 // Given a MenuModel, adapts MenuRunnerImpl which expects a MenuItemView.
19 class MenuRunnerImplAdapter : public MenuRunnerImplInterface { 20 class VIEWS_EXPORT MenuRunnerImplAdapter
21 : public NON_EXPORTED_BASE(MenuRunnerImplInterface) {
20 public: 22 public:
21 explicit MenuRunnerImplAdapter(ui::MenuModel* menu_model); 23 MenuRunnerImplAdapter(ui::MenuModel* menu_model,
24 const base::Closure& on_menu_closed_callback);
22 25
23 // MenuRunnerImplInterface: 26 // MenuRunnerImplInterface:
24 bool IsRunning() const override; 27 bool IsRunning() const override;
25 void Release() override; 28 void Release() override;
26 MenuRunner::RunResult RunMenuAt(Widget* parent, 29 MenuRunner::RunResult RunMenuAt(Widget* parent,
27 MenuButton* button, 30 MenuButton* button,
28 const gfx::Rect& bounds, 31 const gfx::Rect& bounds,
29 MenuAnchorPosition anchor, 32 MenuAnchorPosition anchor,
30 int32_t types) override; 33 int32_t types) override;
31 void Cancel() override; 34 void Cancel() override;
32 base::TimeTicks GetClosingEventTime() const override; 35 base::TimeTicks GetClosingEventTime() const override;
33 36
34 private: 37 private:
35 ~MenuRunnerImplAdapter() override; 38 ~MenuRunnerImplAdapter() override;
36 39
37 std::unique_ptr<MenuModelAdapter> menu_model_adapter_; 40 std::unique_ptr<MenuModelAdapter> menu_model_adapter_;
38 MenuRunnerImpl* impl_; 41 MenuRunnerImpl* impl_;
39 42
40 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter); 43 DISALLOW_COPY_AND_ASSIGN(MenuRunnerImplAdapter);
41 }; 44 };
42 45
43 } // namespace internal 46 } // namespace internal
44 } // namespace views 47 } // namespace views
45 48
46 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_ 49 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_IMPL_ADAPTER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_runner_impl.cc ('k') | ui/views/controls/menu/menu_runner_impl_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698