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

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: also EXIT_DESTROYED 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (nested_menu && result) { 427 if (nested_menu && result) {
428 // We're nested and about to return a value. The caller might enter 428 // We're nested and about to return a value. The caller might enter
429 // another blocking loop. We need to make sure all menus are hidden 429 // another blocking loop. We need to make sure all menus are hidden
430 // before that happens otherwise the menus will stay on screen. 430 // before that happens otherwise the menus will stay on screen.
431 CloseAllNestedMenus(); 431 CloseAllNestedMenus();
432 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT); 432 SetSelection(NULL, SELECTION_UPDATE_IMMEDIATELY | SELECTION_EXIT);
433 433
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 } else if (exit_type_ != EXIT_NONE && message_loop_depth_) {
438 // If we're closing all menus, also mark the next topmost menu
439 // message loop for termination, so that we'll unwind fully.
440 TerminateNestedMessageLoop();
437 } 441 }
438 } 442 }
439 443
440 // Reset our pressed lock to the previous state's, if there was one. 444 // Reset our pressed lock to the previous state's, if there was one.
441 // The lock handles the case if the button was destroyed. 445 // The lock handles the case if the button was destroyed.
442 pressed_lock_.reset(nested_pressed_lock.release()); 446 pressed_lock_.reset(nested_pressed_lock.release());
443 447
444 return result; 448 return result;
445 } 449 }
446 450
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2302 } 2306 }
2303 } 2307 }
2304 2308
2305 gfx::Screen* MenuController::GetScreen() { 2309 gfx::Screen* MenuController::GetScreen() {
2306 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; 2310 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL;
2307 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) 2311 return root ? gfx::Screen::GetScreenFor(root->GetNativeView())
2308 : gfx::Screen::GetNativeScreen(); 2312 : gfx::Screen::GetNativeScreen();
2309 } 2313 }
2310 2314
2311 } // namespace views 2315 } // 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