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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 // when the user hits the APPS key after opening the menu, when no item | 1142 // when the user hits the APPS key after opening the menu, when no item |
1143 // is selected, but showing a context menu for an implicitly-selected | 1143 // is selected, but showing a context menu for an implicitly-selected |
1144 // and invisible item doesn't make sense. | 1144 // and invisible item doesn't make sense. |
1145 ShowContextMenu(pending_state_.item, | 1145 ShowContextMenu(pending_state_.item, |
1146 pending_state_.item->GetKeyboardContextMenuLocation(), | 1146 pending_state_.item->GetKeyboardContextMenuLocation(), |
1147 ui::MENU_SOURCE_KEYBOARD); | 1147 ui::MENU_SOURCE_KEYBOARD); |
1148 } | 1148 } |
1149 break; | 1149 break; |
1150 } | 1150 } |
1151 | 1151 |
| 1152 #if defined(OS_WIN) |
| 1153 // On Windows, pressing Alt and F10 keys should hide the menu to match the |
| 1154 // OS behavior. |
| 1155 case ui::VKEY_MENU: |
| 1156 case ui::VKEY_F10: |
| 1157 Cancel(EXIT_ALL); |
| 1158 break; |
| 1159 #endif |
| 1160 |
1152 default: | 1161 default: |
1153 break; | 1162 break; |
1154 } | 1163 } |
1155 } | 1164 } |
1156 | 1165 |
1157 MenuController::MenuController(bool blocking, | 1166 MenuController::MenuController(bool blocking, |
1158 internal::MenuControllerDelegate* delegate) | 1167 internal::MenuControllerDelegate* delegate) |
1159 : blocking_run_(blocking), | 1168 : blocking_run_(blocking), |
1160 showing_(false), | 1169 showing_(false), |
1161 exit_type_(EXIT_NONE), | 1170 exit_type_(EXIT_NONE), |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 } | 2580 } |
2572 } | 2581 } |
2573 | 2582 |
2574 gfx::Screen* MenuController::GetScreen() { | 2583 gfx::Screen* MenuController::GetScreen() { |
2575 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; | 2584 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; |
2576 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) | 2585 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) |
2577 : gfx::Screen::GetNativeScreen(); | 2586 : gfx::Screen::GetNativeScreen(); |
2578 } | 2587 } |
2579 | 2588 |
2580 } // namespace views | 2589 } // namespace views |
OLD | NEW |