Chromium Code Reviews| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 | 494 |
| 495 // The nested message loop could have been killed externally. Check to see if | 495 // The nested message loop could have been killed externally. Check to see if |
| 496 // there are nested asynchronous menus to shutdown. | 496 // there are nested asynchronous menus to shutdown. |
| 497 if (async_run_ && delegate_stack_.size() > 1) | 497 if (async_run_ && delegate_stack_.size() > 1) |
| 498 ExitAsyncRun(); | 498 ExitAsyncRun(); |
| 499 | 499 |
| 500 return ExitMenuRun(); | 500 return ExitMenuRun(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void MenuController::Cancel(ExitType type) { | 503 void MenuController::Cancel(ExitType type) { |
| 504 // If not currently active, this controller could have been destroyed, and a | |
| 505 // menu is attempting to cancel after destruction. No futher canellation is | |
| 506 // needed. | |
| 507 if (GetActiveInstance() != this) | |
|
sky
2016/07/21 16:07:54
Your comment sort of implies this may be called on
jonross
2016/07/21 18:30:25
Correct, MenuItemViews hold onto a raw pointer to
| |
| 508 return; | |
| 509 | |
| 504 // If the menu has already been destroyed, no further cancellation is | 510 // If the menu has already been destroyed, no further cancellation is |
| 505 // needed. We especially don't want to set the |exit_type_| to a lesser | 511 // needed. We especially don't want to set the |exit_type_| to a lesser |
| 506 // value. | 512 // value. |
| 507 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type) | 513 if (exit_type_ == EXIT_DESTROYED || exit_type_ == type) |
| 508 return; | 514 return; |
| 509 | 515 |
| 510 if (!showing_) { | 516 if (!showing_) { |
| 511 // This occurs if we're in the process of notifying the delegate for a drop | 517 // This occurs if we're in the process of notifying the delegate for a drop |
| 512 // and the delegate cancels us. | 518 // and the delegate cancels us. |
| 513 return; | 519 return; |
| (...skipping 2189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2703 if (hot_button_) | 2709 if (hot_button_) |
| 2704 hot_button_->SetHotTracked(false); | 2710 hot_button_->SetHotTracked(false); |
| 2705 hot_button_ = hot_button; | 2711 hot_button_ = hot_button; |
| 2706 if (hot_button) { | 2712 if (hot_button) { |
| 2707 hot_button->SetHotTracked(true); | 2713 hot_button->SetHotTracked(true); |
| 2708 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); | 2714 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); |
| 2709 } | 2715 } |
| 2710 } | 2716 } |
| 2711 | 2717 |
| 2712 } // namespace views | 2718 } // namespace views |
| OLD | NEW |