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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_action_view.cc

Issue 1411833006: Refactoring to make adding ink drop animations easier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor ink drop animations (comments in c/b/ui/views/) Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_action_view.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/sessions/session_tab_helper.h" 12 #include "chrome/browser/sessions/session_tab_helper.h"
13 #include "chrome/browser/themes/theme_service.h" 13 #include "chrome/browser/themes/theme_service.h"
14 #include "chrome/browser/themes/theme_service_factory.h" 14 #include "chrome/browser/themes/theme_service_factory.h"
15 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h" 15 #include "chrome/browser/ui/toolbar/toolbar_action_view_controller.h"
16 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 16 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
17 #include "chrome/browser/ui/view_ids.h" 17 #include "chrome/browser/ui/view_ids.h"
18 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
20 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
21 #include "ui/accessibility/ax_view_state.h" 21 #include "ui/accessibility/ax_view_state.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/compositor/paint_recorder.h" 23 #include "ui/compositor/paint_recorder.h"
24 #include "ui/events/event.h" 24 #include "ui/events/event.h"
25 #include "ui/gfx/image/image_skia.h" 25 #include "ui/gfx/image/image_skia.h"
26 #include "ui/gfx/image/image_skia_operations.h" 26 #include "ui/gfx/image/image_skia_operations.h"
27 #include "ui/gfx/image/image_skia_source.h" 27 #include "ui/gfx/image/image_skia_source.h"
28 #include "ui/resources/grit/ui_resources.h" 28 #include "ui/resources/grit/ui_resources.h"
29 #include "ui/views/animation/toolbar_ink_drop_delegate.h"
29 #include "ui/views/controls/button/label_button_border.h" 30 #include "ui/views/controls/button/label_button_border.h"
30 #include "ui/views/controls/menu/menu_controller.h" 31 #include "ui/views/controls/menu/menu_controller.h"
31 #include "ui/views/controls/menu/menu_model_adapter.h" 32 #include "ui/views/controls/menu/menu_model_adapter.h"
32 #include "ui/views/controls/menu/menu_runner.h" 33 #include "ui/views/controls/menu/menu_runner.h"
33 #include "ui/views/mouse_constants.h" 34 #include "ui/views/mouse_constants.h"
34 #include "ui/views/resources/grit/views_resources.h" 35 #include "ui/views/resources/grit/views_resources.h"
35 36
36 using views::LabelButtonBorder; 37 using views::LabelButtonBorder;
37 38
38 namespace { 39 namespace {
(...skipping 20 matching lines...) Expand all
59 ToolbarActionViewController* view_controller, 60 ToolbarActionViewController* view_controller,
60 Profile* profile, 61 Profile* profile,
61 ToolbarActionView::Delegate* delegate) 62 ToolbarActionView::Delegate* delegate)
62 : MenuButton(nullptr, base::string16(), this, false), 63 : MenuButton(nullptr, base::string16(), this, false),
63 view_controller_(view_controller), 64 view_controller_(view_controller),
64 profile_(profile), 65 profile_(profile),
65 delegate_(delegate), 66 delegate_(delegate),
66 called_register_command_(false), 67 called_register_command_(false),
67 wants_to_run_(false), 68 wants_to_run_(false),
68 menu_(nullptr), 69 menu_(nullptr),
70 ink_drop_delegate_(new views::ToolbarInkDropDelegate(this, this)),
69 weak_factory_(this) { 71 weak_factory_(this) {
70 set_id(VIEW_ID_BROWSER_ACTION); 72 set_id(VIEW_ID_BROWSER_ACTION);
71 view_controller_->SetDelegate(this); 73 view_controller_->SetDelegate(this);
72 SetHorizontalAlignment(gfx::ALIGN_CENTER); 74 SetHorizontalAlignment(gfx::ALIGN_CENTER);
73 set_drag_controller(delegate_); 75 set_drag_controller(delegate_);
74 76
75 set_context_menu_controller(this); 77 set_context_menu_controller(this);
76 78
79 const int kInkDropLargeSize = 32;
80 const int kInkDropLargeCornerRadius = 5;
81 const int kInkDropSmallSize = 24;
82 const int kInkDropSmallCornerRadius = 2;
83 GetInkDropDelegate()->SetInkDropSize(
84 kInkDropLargeSize, kInkDropLargeCornerRadius, kInkDropSmallSize,
85 kInkDropSmallCornerRadius);
86
77 // We also listen for browser theme changes on linux because a switch from or 87 // We also listen for browser theme changes on linux because a switch from or
78 // to GTK requires that we regrab our browser action images. 88 // to GTK requires that we regrab our browser action images.
79 registrar_.Add( 89 registrar_.Add(
80 this, 90 this,
81 chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 91 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
82 content::Source<ThemeService>( 92 content::Source<ThemeService>(
83 ThemeServiceFactory::GetForProfile(profile_))); 93 ThemeServiceFactory::GetForProfile(profile_)));
84 94
85 // If the button is within a menu, we need to make it focusable in order to 95 // If the button is within a menu, we need to make it focusable in order to
86 // have it accessible via keyboard navigation, but it shouldn't request focus 96 // have it accessible via keyboard navigation, but it shouldn't request focus
87 // (because that would close the menu). 97 // (because that would close the menu).
88 if (delegate_->ShownInsideMenu()) { 98 if (delegate_->ShownInsideMenu()) {
89 set_request_focus_on_press(false); 99 set_request_focus_on_press(false);
90 SetFocusable(true); 100 SetFocusable(true);
91 } 101 }
92 102
93 UpdateState(); 103 UpdateState();
94 } 104 }
95 105
96 ToolbarActionView::~ToolbarActionView() { 106 ToolbarActionView::~ToolbarActionView() {
97 if (context_menu_owner == this) 107 if (context_menu_owner == this)
98 context_menu_owner = nullptr; 108 context_menu_owner = nullptr;
99 view_controller_->SetDelegate(nullptr); 109 view_controller_->SetDelegate(nullptr);
100 } 110 }
101 111
102 gfx::Size ToolbarActionView::GetPreferredSize() const {
103 return gfx::Size(ToolbarActionsBar::IconWidth(false),
104 ToolbarActionsBar::IconHeight());
105 }
106
107 void ToolbarActionView::OnDragDone() {
108 views::MenuButton::OnDragDone();
109 delegate_->OnToolbarActionViewDragDone();
110 }
111
112 void ToolbarActionView::ViewHierarchyChanged(
113 const ViewHierarchyChangedDetails& details) {
114 if (details.is_add && !called_register_command_ && GetFocusManager()) {
115 view_controller_->RegisterCommand();
116 called_register_command_ = true;
117 }
118
119 MenuButton::ViewHierarchyChanged(details);
120 }
121
122 void ToolbarActionView::GetAccessibleState(ui::AXViewState* state) { 112 void ToolbarActionView::GetAccessibleState(ui::AXViewState* state) {
123 views::MenuButton::GetAccessibleState(state); 113 views::MenuButton::GetAccessibleState(state);
124 state->role = ui::AX_ROLE_BUTTON; 114 state->role = ui::AX_ROLE_BUTTON;
125 } 115 }
126 116
117 scoped_ptr<LabelButtonBorder> ToolbarActionView::CreateDefaultBorder() const {
118 scoped_ptr<LabelButtonBorder> border = LabelButton::CreateDefaultBorder();
119 border->set_insets(gfx::Insets(kBorderInset, kBorderInset,
120 kBorderInset, kBorderInset));
121 return border.Pass();
122 }
123
124 void ToolbarActionView::OnMouseEntered(const ui::MouseEvent& event) {
125 delegate_->OnMouseEnteredToolbarActionView();
126 views::MenuButton::OnMouseEntered(event);
127 }
128
129 bool ToolbarActionView::ShouldEnterPushedState(const ui::Event& event) {
130 return views::MenuButton::ShouldEnterPushedState(event) &&
131 (base::TimeTicks::Now() - popup_closed_time_).InMilliseconds() >
132 views::kMinimumMsBetweenButtonClicks;
133 }
134
127 void ToolbarActionView::OnMenuButtonClicked(views::View* sender, 135 void ToolbarActionView::OnMenuButtonClicked(views::View* sender,
128 const gfx::Point& point) { 136 const gfx::Point& point) {
129 if (!view_controller_->IsEnabled(GetCurrentWebContents())) { 137 if (!view_controller_->IsEnabled(GetCurrentWebContents())) {
130 // We should only get a button pressed event with a non-enabled action if 138 // We should only get a button pressed event with a non-enabled action if
131 // the left-click behavior should open the menu. 139 // the left-click behavior should open the menu.
132 DCHECK(view_controller_->DisabledClickOpensMenu()); 140 DCHECK(view_controller_->DisabledClickOpensMenu());
133 context_menu_controller()->ShowContextMenuForView(this, point, 141 context_menu_controller()->ShowContextMenuForView(this, point,
134 ui::MENU_SOURCE_NONE); 142 ui::MENU_SOURCE_NONE);
135 } else { 143 } else {
136 view_controller_->ExecuteAction(true); 144 view_controller_->ExecuteAction(true);
137 } 145 }
138 } 146 }
139 147
148 void ToolbarActionView::Observe(int type,
149 const content::NotificationSource& source,
150 const content::NotificationDetails& details) {
151 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
152 UpdateState();
153 }
154
155 content::WebContents* ToolbarActionView::GetCurrentWebContents() const {
156 return delegate_->GetCurrentWebContents();
157 }
158
140 void ToolbarActionView::UpdateState() { 159 void ToolbarActionView::UpdateState() {
141 content::WebContents* web_contents = GetCurrentWebContents(); 160 content::WebContents* web_contents = GetCurrentWebContents();
142 if (SessionTabHelper::IdForTab(web_contents) < 0) 161 if (SessionTabHelper::IdForTab(web_contents) < 0)
143 return; 162 return;
144 163
145 if (!view_controller_->IsEnabled(web_contents) && 164 if (!view_controller_->IsEnabled(web_contents) &&
146 !view_controller_->DisabledClickOpensMenu()) { 165 !view_controller_->DisabledClickOpensMenu()) {
147 SetState(views::CustomButton::STATE_DISABLED); 166 SetState(views::CustomButton::STATE_DISABLED);
148 } else if (state() == views::CustomButton::STATE_DISABLED) { 167 } else if (state() == views::CustomButton::STATE_DISABLED) {
149 SetState(views::CustomButton::STATE_NORMAL); 168 SetState(views::CustomButton::STATE_NORMAL);
(...skipping 13 matching lines...) Expand all
163 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon)); 182 gfx::ImageSkiaOperations::CreateSuperimposedImage(bg, icon));
164 } 183 }
165 184
166 SetTooltipText(view_controller_->GetTooltip(web_contents)); 185 SetTooltipText(view_controller_->GetTooltip(web_contents));
167 SetAccessibleName(view_controller_->GetAccessibleName(web_contents)); 186 SetAccessibleName(view_controller_->GetAccessibleName(web_contents));
168 187
169 Layout(); // We need to layout since we may have added an icon as a result. 188 Layout(); // We need to layout since we may have added an icon as a result.
170 SchedulePaint(); 189 SchedulePaint();
171 } 190 }
172 191
173 void ToolbarActionView::Observe(int type, 192 void ToolbarActionView::AddInkDropLayer(ui::Layer* ink_drop_layer) {
174 const content::NotificationSource& source, 193 SetPaintToLayer(true);
175 const content::NotificationDetails& details) { 194 SetFillsBoundsOpaquely(false);
176 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); 195 image()->SetPaintToLayer(true);
177 UpdateState(); 196 image()->SetFillsBoundsOpaquely(false);
197
198 layer()->Add(ink_drop_layer);
199 layer()->StackAtBottom(ink_drop_layer);
178 } 200 }
179 201
180 void ToolbarActionView::OnMouseEntered(const ui::MouseEvent& event) { 202 void ToolbarActionView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
181 delegate_->OnMouseEnteredToolbarActionView(); 203 layer()->Remove(ink_drop_layer);
182 views::MenuButton::OnMouseEntered(event);
183 }
184 204
185 bool ToolbarActionView::ShouldEnterPushedState(const ui::Event& event) { 205 image()->SetFillsBoundsOpaquely(true);
186 return views::MenuButton::ShouldEnterPushedState(event) && 206 image()->SetPaintToLayer(false);
187 (base::TimeTicks::Now() - popup_closed_time_).InMilliseconds() > 207 SetPaintToLayer(false);
188 views::kMinimumMsBetweenButtonClicks;
189 }
190
191 scoped_ptr<LabelButtonBorder> ToolbarActionView::CreateDefaultBorder() const {
192 scoped_ptr<LabelButtonBorder> border = LabelButton::CreateDefaultBorder();
193 border->set_insets(gfx::Insets(kBorderInset, kBorderInset,
194 kBorderInset, kBorderInset));
195 return border.Pass();
196 } 208 }
197 209
198 gfx::ImageSkia ToolbarActionView::GetIconForTest() { 210 gfx::ImageSkia ToolbarActionView::GetIconForTest() {
199 return GetImage(views::Button::STATE_NORMAL); 211 return GetImage(views::Button::STATE_NORMAL);
200 } 212 }
201 213
202 void ToolbarActionView::set_context_menu_callback_for_testing( 214 void ToolbarActionView::set_context_menu_callback_for_testing(
203 base::Callback<void(ToolbarActionView*)>* callback) { 215 base::Callback<void(ToolbarActionView*)>* callback) {
204 context_menu_callback = callback; 216 context_menu_callback = callback;
205 } 217 }
206 218
219 gfx::Size ToolbarActionView::GetPreferredSize() const {
220 return gfx::Size(ToolbarActionsBar::IconWidth(false),
221 ToolbarActionsBar::IconHeight());
222 }
223
224 bool ToolbarActionView::OnMousePressed(const ui::MouseEvent& event) {
225 // views::MenuButton actions are only triggered by left mouse clicks.
226 if (event.IsOnlyLeftMouseButton())
227 GetInkDropDelegate()->OnAction(views::InkDropState::ACTION_PENDING);
228 return MenuButton::OnMousePressed(event);
229 }
230
231 void ToolbarActionView::OnGestureEvent(ui::GestureEvent* event) {
232 // While dropdown menu is showing the button should not handle gestures.
Peter Kasting 2015/11/24 22:27:16 Nit: Add "the" before "dropdown" and comma after "
varkha 2015/11/25 18:53:23 Done.
233 if (menu_)
234 event->StopPropagation();
235 else
236 MenuButton::OnGestureEvent(event);
237 }
238
239 void ToolbarActionView::OnDragDone() {
240 views::MenuButton::OnDragDone();
241 delegate_->OnToolbarActionViewDragDone();
242 }
243
244 void ToolbarActionView::ViewHierarchyChanged(
245 const ViewHierarchyChangedDetails& details) {
246 if (details.is_add && !called_register_command_ && GetFocusManager()) {
247 view_controller_->RegisterCommand();
248 called_register_command_ = true;
249 }
250
251 MenuButton::ViewHierarchyChanged(details);
252 }
253
254 views::InkDropDelegate* ToolbarActionView::GetInkDropDelegate() const {
255 return ink_drop_delegate_.get();
256 }
257
207 views::View* ToolbarActionView::GetAsView() { 258 views::View* ToolbarActionView::GetAsView() {
208 return this; 259 return this;
209 } 260 }
210 261
211 views::FocusManager* ToolbarActionView::GetFocusManagerForAccelerator() { 262 views::FocusManager* ToolbarActionView::GetFocusManagerForAccelerator() {
212 return GetFocusManager(); 263 return GetFocusManager();
213 } 264 }
214 265
215 views::View* ToolbarActionView::GetReferenceViewForPopup() { 266 views::View* ToolbarActionView::GetReferenceViewForPopup() {
216 // Browser actions in the overflow menu can still show popups, so we may need 267 // Browser actions in the overflow menu can still show popups, so we may need
217 // a reference view other than this button's parent. If so, use the overflow 268 // a reference view other than this button's parent. If so, use the overflow
218 // view. 269 // view.
219 return visible() ? this : delegate_->GetOverflowReferenceView(); 270 return visible() ? this : delegate_->GetOverflowReferenceView();
220 } 271 }
221 272
222 bool ToolbarActionView::IsMenuRunning() const { 273 bool ToolbarActionView::IsMenuRunning() const {
223 return menu_ != nullptr; 274 return menu_ != nullptr;
224 } 275 }
225 276
226 content::WebContents* ToolbarActionView::GetCurrentWebContents() const {
227 return delegate_->GetCurrentWebContents();
228 }
229
230 void ToolbarActionView::OnPopupShown(bool by_user) { 277 void ToolbarActionView::OnPopupShown(bool by_user) {
231 // If this was through direct user action, we press the menu button. 278 // If this was through direct user action, we press the menu button.
232 if (by_user) { 279 if (by_user) {
233 // We set the state of the menu button we're using as a reference view, 280 // We set the state of the menu button we're using as a reference view,
234 // which is either this or the overflow reference view. 281 // which is either this or the overflow reference view.
235 // This cast is safe because GetReferenceViewForPopup returns either |this| 282 // This cast is safe because GetReferenceViewForPopup returns either |this|
236 // or delegate_->GetOverflowReferenceView(), which returns a MenuButton. 283 // or delegate_->GetOverflowReferenceView(), which returns a MenuButton.
237 views::MenuButton* reference_view = 284 views::MenuButton* reference_view =
238 static_cast<views::MenuButton*>(GetReferenceViewForPopup()); 285 static_cast<views::MenuButton*>(GetReferenceViewForPopup());
239 pressed_lock_.reset(new views::MenuButton::PressedLock(reference_view)); 286 pressed_lock_.reset(new views::MenuButton::PressedLock(reference_view));
(...skipping 24 matching lines...) Expand all
264 weak_factory_.GetWeakPtr(), 311 weak_factory_.GetWeakPtr(),
265 source_type); 312 source_type);
266 } 313 }
267 if (CloseActiveMenuIfNeeded()) 314 if (CloseActiveMenuIfNeeded())
268 return; 315 return;
269 316
270 // Otherwise, no other menu is showing, and we can proceed normally. 317 // Otherwise, no other menu is showing, and we can proceed normally.
271 DoShowContextMenu(source_type); 318 DoShowContextMenu(source_type);
272 } 319 }
273 320
321 gfx::Point ToolbarActionView::CalculateInkDropCenter() const {
322 return GetLocalBounds().CenterPoint();
323 }
324
274 void ToolbarActionView::DoShowContextMenu( 325 void ToolbarActionView::DoShowContextMenu(
275 ui::MenuSourceType source_type) { 326 ui::MenuSourceType source_type) {
276 ui::MenuModel* context_menu_model = view_controller_->GetContextMenu(); 327 ui::MenuModel* context_menu_model = view_controller_->GetContextMenu();
277 // It's possible the action doesn't have a context menu. 328 // It's possible the action doesn't have a context menu.
278 if (!context_menu_model) 329 if (!context_menu_model)
279 return; 330 return;
280 331
281 DCHECK(visible()); // We should never show a context menu for a hidden item. 332 DCHECK(visible()); // We should never show a context menu for a hidden item.
282 DCHECK(!context_menu_owner); 333 DCHECK(!context_menu_owner);
283 334
284 gfx::Point screen_loc; 335 gfx::Point screen_loc;
285 ConvertPointToScreen(this, &screen_loc); 336 ConvertPointToScreen(this, &screen_loc);
286 337
287 int run_types = 338 int run_types =
288 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU; 339 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU;
289 if (delegate_->ShownInsideMenu()) 340 if (delegate_->ShownInsideMenu())
290 run_types |= views::MenuRunner::IS_NESTED; 341 run_types |= views::MenuRunner::IS_NESTED;
291 342
292 // RunMenuAt expects a nested menu to be parented by the same widget as the 343 // RunMenuAt expects a nested menu to be parented by the same widget as the
293 // already visible menu, in this case the Chrome menu. 344 // already visible menu, in this case the Chrome menu.
294 views::Widget* parent = delegate_->ShownInsideMenu() ? 345 views::Widget* parent = delegate_->ShownInsideMenu() ?
295 delegate_->GetOverflowReferenceView()->GetWidget() : 346 delegate_->GetOverflowReferenceView()->GetWidget() :
296 GetWidget(); 347 GetWidget();
297 348
349 GetInkDropDelegate()->OnAction(views::InkDropState::ACTIVATED);
350
298 views::MenuModelAdapter adapter(context_menu_model); 351 views::MenuModelAdapter adapter(context_menu_model);
299 menu_ = adapter.CreateMenu(); 352 menu_ = adapter.CreateMenu();
300 menu_runner_.reset(new views::MenuRunner(menu_, run_types)); 353 menu_runner_.reset(new views::MenuRunner(menu_, run_types));
301 354
302 if (context_menu_callback) 355 if (context_menu_callback)
303 context_menu_callback->Run(this); 356 context_menu_callback->Run(this);
304 if (menu_runner_->RunMenuAt(parent, this, gfx::Rect(screen_loc, size()), 357 if (menu_runner_->RunMenuAt(parent, this, gfx::Rect(screen_loc, size()),
305 views::MENU_ANCHOR_TOPLEFT, 358 views::MENU_ANCHOR_TOPLEFT,
306 source_type) == views::MenuRunner::MENU_DELETED) { 359 source_type) == views::MenuRunner::MENU_DELETED) {
307 return; 360 return;
308 } 361 }
362 GetInkDropDelegate()->OnAction(views::InkDropState::DEACTIVATED);
309 363
310 menu_runner_.reset(); 364 menu_runner_.reset();
311 menu_ = nullptr; 365 menu_ = nullptr;
312 context_menu_owner = nullptr; 366 context_menu_owner = nullptr;
313 view_controller_->OnContextMenuClosed(); 367 view_controller_->OnContextMenuClosed();
314 368
315 // If another extension action wants to show its context menu, allow it to. 369 // If another extension action wants to show its context menu, allow it to.
316 if (!followup_context_menu_task_.is_null()) { 370 if (!followup_context_menu_task_.is_null()) {
317 base::Closure task = followup_context_menu_task_; 371 base::Closure task = followup_context_menu_task_;
318 followup_context_menu_task_ = base::Closure(); 372 followup_context_menu_task_ = base::Closure();
(...skipping 14 matching lines...) Expand all
333 if (menu_controller->in_nested_run()) { 387 if (menu_controller->in_nested_run()) {
334 // There is another menu showing. Close the outermost menu (since we are 388 // There is another menu showing. Close the outermost menu (since we are
335 // shown in the same menu, we don't want to close the whole thing). 389 // shown in the same menu, we don't want to close the whole thing).
336 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST); 390 menu_controller->Cancel(views::MenuController::EXIT_OUTERMOST);
337 return true; 391 return true;
338 } 392 }
339 } 393 }
340 394
341 return false; 395 return false;
342 } 396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698