| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 exit_type() == MenuController::EXIT_DESTROYED) { | 1023 exit_type() == MenuController::EXIT_DESTROYED) { |
| 1024 TerminateNestedMessageLoopIfNecessary(); | 1024 TerminateNestedMessageLoopIfNecessary(); |
| 1025 return ui::POST_DISPATCH_PERFORM_DEFAULT; | 1025 return ui::POST_DISPATCH_PERFORM_DEFAULT; |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 if (character) | 1028 if (character) |
| 1029 SelectByChar(character); | 1029 SelectByChar(character); |
| 1030 else | 1030 else |
| 1031 OnKeyDown(key_code); | 1031 OnKeyDown(key_code); |
| 1032 | 1032 |
| 1033 TerminateNestedMessageLoopIfNecessary(); | 1033 // MenuController may have been deleted, so check for an active instance |
| 1034 // before accessing member variables. |
| 1035 if (GetActiveInstance()) |
| 1036 TerminateNestedMessageLoopIfNecessary(); |
| 1034 | 1037 |
| 1035 return ui::POST_DISPATCH_NONE; | 1038 return ui::POST_DISPATCH_NONE; |
| 1036 } | 1039 } |
| 1037 | 1040 |
| 1038 void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) { | 1041 void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) { |
| 1039 if (submenu->IsShowing()) { | 1042 if (submenu->IsShowing()) { |
| 1040 gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint(); | 1043 gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint(); |
| 1041 const SubmenuView* root_submenu = | 1044 const SubmenuView* root_submenu = |
| 1042 submenu->GetMenuItem()->GetRootMenuItem()->GetSubmenu(); | 1045 submenu->GetMenuItem()->GetRootMenuItem()->GetSubmenu(); |
| 1043 View::ConvertPointFromScreen( | 1046 View::ConvertPointFromScreen( |
| (...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2664 return; | 2667 return; |
| 2665 } | 2668 } |
| 2666 if (hot_button_) | 2669 if (hot_button_) |
| 2667 hot_button_->SetHotTracked(false); | 2670 hot_button_->SetHotTracked(false); |
| 2668 hot_button_ = hot_button; | 2671 hot_button_ = hot_button; |
| 2669 if (hot_button) | 2672 if (hot_button) |
| 2670 hot_button->SetHotTracked(true); | 2673 hot_button->SetHotTracked(true); |
| 2671 } | 2674 } |
| 2672 | 2675 |
| 2673 } // namespace views | 2676 } // namespace views |
| OLD | NEW |