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

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

Issue 2620203004: MenuRunner: Add comment to specify blocking behavior on MacViews. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // The menu is a nested context menu. For example, click a folder on the 72 // The menu is a nested context menu. For example, click a folder on the
73 // bookmark bar, then right click an entry to get its context menu. 73 // bookmark bar, then right click an entry to get its context menu.
74 IS_NESTED = 1 << 1, 74 IS_NESTED = 1 << 1,
75 75
76 // Used for showing a menu during a drop operation. This does NOT block the 76 // Used for showing a menu during a drop operation. This does NOT block the
77 // caller, instead the delegate is notified when the menu closes via the 77 // caller, instead the delegate is notified when the menu closes via the
78 // DropMenuClosed method. 78 // DropMenuClosed method.
79 FOR_DROP = 1 << 2, 79 FOR_DROP = 1 << 2,
80 80
81 // The menu is a context menu (not necessarily nested), for example right 81 // The menu is a context menu (not necessarily nested), for example right
82 // click on a link on a website in the browser. 82 // click on a link on a website in the browser. On Mac(Views), this is
83 // displayed using a native NSMenu and hence is blocking.
83 CONTEXT_MENU = 1 << 3, 84 CONTEXT_MENU = 1 << 3,
84 85
85 // The menu should behave like a Windows native Combobox dropdow menu. 86 // The menu should behave like a Windows native Combobox dropdow menu. This
86 // This behavior includes accepting the pending item and closing on F4. 87 // behavior includes accepting the pending item and closing on F4. On
88 // Mac(Views), this is displayed using a native NSMenu and hence is
89 // blocking.
87 COMBOBOX = 1 << 4, 90 COMBOBOX = 1 << 4,
88 91
89 // A child view is performing a drag-and-drop operation, so the menu should 92 // A child view is performing a drag-and-drop operation, so the menu should
90 // stay open (even if it doesn't receive drag updated events). In this case, 93 // stay open (even if it doesn't receive drag updated events). In this case,
91 // the caller is responsible for closing the menu upon completion of the 94 // the caller is responsible for closing the menu upon completion of the
92 // drag-and-drop. 95 // drag-and-drop.
93 NESTED_DRAG = 1 << 5, 96 NESTED_DRAG = 1 << 5,
94 97
95 // Used for showing a menu which does NOT block the caller. Instead the 98 // Used for showing a menu which does NOT block the caller. Instead the
96 // delegate is notified when the menu closes via OnMenuClosed. 99 // delegate is notified when the menu closes via OnMenuClosed. On
100 // Mac(Views), this is ignored for the CONTEXT_MENU and COMBOBOX run types.
97 ASYNC = 1 << 6, 101 ASYNC = 1 << 6,
98 }; 102 };
99 103
100 enum RunResult { 104 enum RunResult {
101 // Indicates RunMenuAt is returning because the MenuRunner was deleted. 105 // Indicates RunMenuAt is returning because the MenuRunner was deleted.
102 MENU_DELETED, 106 MENU_DELETED,
103 107
104 // Indicates RunMenuAt returned and MenuRunner was not deleted. 108 // Indicates RunMenuAt returned and MenuRunner was not deleted.
105 NORMAL_EXIT 109 NORMAL_EXIT
106 }; 110 };
107 111
108 // Creates a new MenuRunner, which may use a native menu if available. 112 // Creates a new MenuRunner, which may use a native menu if available.
tapted 2017/01/17 21:55:20 This comment already mentions native menus. So per
109 // |run_types| is a bitmask of RunTypes. If provided, 113 // |run_types| is a bitmask of RunTypes. If provided,
110 // |on_menu_closed_callback| is invoked when the menu is closed. 114 // |on_menu_closed_callback| is invoked when the menu is closed.
111 MenuRunner(ui::MenuModel* menu_model, 115 MenuRunner(ui::MenuModel* menu_model,
112 int32_t run_types, 116 int32_t run_types,
113 const base::Closure& on_menu_closed_callback = base::Closure()); 117 const base::Closure& on_menu_closed_callback = base::Closure());
114 118
115 // Creates a runner for a custom-created toolkit-views menu. 119 // Creates a runner for a custom-created toolkit-views menu.
116 MenuRunner(MenuItemView* menu, int32_t run_types); 120 MenuRunner(MenuItemView* menu, int32_t run_types);
tapted 2017/01/17 21:55:20 So I think using this constructor, run_types on Ma
karandeepb 2017/01/19 04:18:15 Oh yeah, you are correct. Did not see this constru
117 ~MenuRunner(); 121 ~MenuRunner();
118 122
119 // Runs the menu. If this returns MENU_DELETED the method is returning 123 // Runs the menu. If this returns MENU_DELETED the method is returning
120 // because the MenuRunner was deleted. 124 // because the MenuRunner was deleted.
121 // Typically callers should NOT do any processing if this returns 125 // Typically callers should NOT do any processing if this returns
122 // MENU_DELETED. 126 // MENU_DELETED.
123 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by 127 // If |anchor| uses a |BUBBLE_..| type, the bounds will get determined by
124 // using |bounds| as the thing to point at in screen coordinates. 128 // using |bounds| as the thing to point at in screen coordinates.
125 RunResult RunMenuAt(Widget* parent, 129 RunResult RunMenuAt(Widget* parent,
126 MenuButton* button, 130 MenuButton* button,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 177
174 protected: 178 protected:
175 DisplayChangeListener() {} 179 DisplayChangeListener() {}
176 }; 180 };
177 181
178 } // namespace internal 182 } // namespace internal
179 183
180 } // namespace views 184 } // namespace views
181 185
182 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_ 186 #endif // UI_VIEWS_CONTROLS_MENU_MENU_RUNNER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698