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

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 831413002: views: menu: Unwind multiple menu message loops eagerly with EXIT_ALL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 #include "ui/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 // Set exit_all_, which makes sure all nested loops exit immediately. 434 // Set exit_all_, which makes sure all nested loops exit immediately.
435 if (exit_type_ != EXIT_DESTROYED) 435 if (exit_type_ != EXIT_DESTROYED)
436 SetExitType(EXIT_ALL); 436 SetExitType(EXIT_ALL);
437 } 437 }
438 } 438 }
439 439
440 // Reset our pressed lock to the previous state's, if there was one. 440 // Reset our pressed lock to the previous state's, if there was one.
441 // The lock handles the case if the button was destroyed. 441 // The lock handles the case if the button was destroyed.
442 pressed_lock_.reset(nested_pressed_lock.release()); 442 pressed_lock_.reset(nested_pressed_lock.release());
443 443
444 // If we're closing all menus, also mark the next topmost menu
445 // message loop for termination, so that we'll unwind fully.
446 if (exit_type_ == EXIT_ALL && message_loop_depth_)
447 TerminateNestedMessageLoop();
sky 2015/01/06 01:00:15 Move this up to around 437'ish. An else case for t
spang 2015/01/06 19:14:12 Done.
448
444 return result; 449 return result;
445 } 450 }
446 451
447 void MenuController::Cancel(ExitType type) { 452 void MenuController::Cancel(ExitType type) {
448 // If the menu has already been destroyed, no further cancellation is 453 // If the menu has already been destroyed, no further cancellation is
449 // needed. We especially don't want to set the |exit_type_| to a lesser 454 // needed. We especially don't want to set the |exit_type_| to a lesser
450 // value. 455 // value.
451 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type) 456 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type)
452 return; 457 return;
453 458
(...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 } 2307 }
2303 } 2308 }
2304 2309
2305 gfx::Screen* MenuController::GetScreen() { 2310 gfx::Screen* MenuController::GetScreen() {
2306 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; 2311 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
2307 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) 2312 return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
2308 : gfx::Screen::GetNativeScreen(); 2313 : gfx::Screen::GetNativeScreen();
2309 } 2314 }
2310 2315
2311 } // namespace views 2316 } // namespace views
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