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

Side by Side Diff: ui/views/controls/menu/menu_runner.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
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_RUNNER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/callback.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "ui/base/ui_base_types.h" 15 #include "ui/base/ui_base_types.h"
15 #include "ui/views/controls/menu/menu_types.h" 16 #include "ui/views/controls/menu/menu_types.h"
16 #include "ui/views/views_export.h" 17 #include "ui/views/views_export.h"
17 18
18 namespace base { 19 namespace base {
19 class TimeTicks; 20 class TimeTicks;
20 } 21 }
21 22
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 }; 99 };
99 100
100 enum RunResult { 101 enum RunResult {
101 // Indicates RunMenuAt is returning because the MenuRunner was deleted. 102 // Indicates RunMenuAt is returning because the MenuRunner was deleted.
102 MENU_DELETED, 103 MENU_DELETED,
103 104
104 // Indicates RunMenuAt returned and MenuRunner was not deleted. 105 // Indicates RunMenuAt returned and MenuRunner was not deleted.
105 NORMAL_EXIT 106 NORMAL_EXIT
106 }; 107 };
107 108
108 // Creates a new MenuRunner. 109 // Creates a new MenuRunner, which may use a native menu if available.
109 // |run_types| is a bitmask of RunTypes. 110 // |run_types| is a bitmask of RunTypes. If provided,
110 MenuRunner(ui::MenuModel* menu_model, int32_t run_types); 111 // |on_menu_closed_callback| is invoked when the menu is closed.
112 MenuRunner(ui::MenuModel* menu_model,
113 int32_t run_types,
114 const base::Closure& on_menu_closed_callback = base::Closure());
115
116 // Creates a runner for a custom-created toolkit-views menu.
111 MenuRunner(MenuItemView* menu, int32_t run_types); 117 MenuRunner(MenuItemView* menu, int32_t run_types);
112 ~MenuRunner(); 118 ~MenuRunner();
113 119
114 // Runs the menu. If this returns MENU_DELETED the method is returning 120 // Runs the menu. If this returns MENU_DELETED the method is returning
115 // because the MenuRunner was deleted. 121 // because the MenuRunner was deleted.
116 // Typically callers should NOT do any processing if this returns 122 // Typically callers should NOT do any processing if this returns
117 // MENU_DELETED. 123 // MENU_DELETED.
118 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by 124 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by
119 // using |bounds| as the thing to point at in screen coordinates. 125 // using |bounds| as the thing to point at in screen coordinates.
120 RunResult RunMenuAt(Widget* parent, 126 RunResult RunMenuAt(Widget* parent,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 174
169 protected: 175 protected:
170 DisplayChangeListener() {} 176 DisplayChangeListener() {}
171 }; 177 };
172 178
173 } // namespace internal 179 } // namespace internal
174 180
175 } // namespace views 181 } // namespace views
176 182
177 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ 183 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
OLDNEW
« no previous file with comments | « ui/views/controls/combobox/combobox.cc ('k') | ui/views/controls/menu/menu_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698