OLD | NEW |
---|---|
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 Loading... | |
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_ALL && message_loop_depth_) { | |
spang
2015/01/06 19:22:27
Er, I think EXIT_DESTROYED also needs this treatme
| |
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 Loading... | |
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 |
OLD | NEW |