| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 if (!blocking_run_) { | 525 if (!blocking_run_) { |
| 526 // If we didn't block the caller we need to notify the menu, which | 526 // If we didn't block the caller we need to notify the menu, which |
| 527 // triggers deleting us. | 527 // triggers deleting us. |
| 528 DCHECK(selected); | 528 DCHECK(selected); |
| 529 showing_ = false; | 529 showing_ = false; |
| 530 delegate_->OnMenuClosed(internal::MenuControllerDelegate::NOTIFY_DELEGATE, | 530 delegate_->OnMenuClosed(internal::MenuControllerDelegate::NOTIFY_DELEGATE, |
| 531 selected->GetRootMenuItem(), accept_event_flags_); | 531 selected->GetRootMenuItem(), accept_event_flags_); |
| 532 // WARNING: the call to MenuClosed deletes us. | 532 // WARNING: the call to MenuClosed deletes us. |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 ExitAsyncRun(); | 535 |
| 536 // On Windows and Linux the destruction of this menu's Widget leads to the |
| 537 // teardown of the platform specific drag-and-drop Widget. Do not shutdown |
| 538 // while dragging, leave the Widget hidden until drag-and-drop has completed, |
| 539 // at which point all menus will be destroyed. |
| 540 if (!drag_in_progress_) |
| 541 ExitAsyncRun(); |
| 536 } | 542 } |
| 537 | 543 |
| 538 void MenuController::AddNestedDelegate( | 544 void MenuController::AddNestedDelegate( |
| 539 internal::MenuControllerDelegate* delegate) { | 545 internal::MenuControllerDelegate* delegate) { |
| 540 delegate_stack_.push_back(std::make_pair(delegate, async_run_)); | 546 delegate_stack_.push_back(std::make_pair(delegate, async_run_)); |
| 541 delegate_ = delegate; | 547 delegate_ = delegate; |
| 542 } | 548 } |
| 543 | 549 |
| 544 void MenuController::SetAsyncRun(bool is_async) { | 550 void MenuController::SetAsyncRun(bool is_async) { |
| 545 delegate_stack_.back().second = is_async; | 551 delegate_stack_.back().second = is_async; |
| (...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 if (hot_button_) | 2712 if (hot_button_) |
| 2707 hot_button_->SetHotTracked(false); | 2713 hot_button_->SetHotTracked(false); |
| 2708 hot_button_ = hot_button; | 2714 hot_button_ = hot_button; |
| 2709 if (hot_button) { | 2715 if (hot_button) { |
| 2710 hot_button->SetHotTracked(true); | 2716 hot_button->SetHotTracked(true); |
| 2711 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); | 2717 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); |
| 2712 } | 2718 } |
| 2713 } | 2719 } |
| 2714 | 2720 |
| 2715 } // namespace views | 2721 } // namespace views |
| OLD | NEW |