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 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1027 break; | 1027 break; |
1028 | 1028 |
1029 case ui::VKEY_SPACE: | 1029 case ui::VKEY_SPACE: |
1030 if (SendAcceleratorToHotTrackedView() == ACCELERATOR_PROCESSED_EXIT) | 1030 if (SendAcceleratorToHotTrackedView() == ACCELERATOR_PROCESSED_EXIT) |
1031 return false; | 1031 return false; |
1032 break; | 1032 break; |
1033 | 1033 |
1034 case ui::VKEY_F4: | 1034 case ui::VKEY_F4: |
1035 if (!is_combobox_) | 1035 if (!is_combobox_) |
1036 break; | 1036 break; |
1037 // Fallthrough to accept on F4, so combobox menus match Windows behavior. | 1037 // Fallthrough to accept or dismiss combobox menus on F4, like windows. |
1038 case ui::VKEY_RETURN: | 1038 case ui::VKEY_RETURN: |
1039 if (pending_state_.item) { | 1039 if (pending_state_.item) { |
1040 if (pending_state_.item->HasSubmenu()) { | 1040 if (pending_state_.item->HasSubmenu()) { |
1041 OpenSubmenuChangeSelectionIfCan(); | 1041 if (key_code == ui::VKEY_F4 && |
| 1042 pending_state_.item->GetSubmenu()->IsShowing()) |
| 1043 return false; |
| 1044 else |
| 1045 OpenSubmenuChangeSelectionIfCan(); |
1042 } else { | 1046 } else { |
1043 SendAcceleratorResultType result = SendAcceleratorToHotTrackedView(); | 1047 SendAcceleratorResultType result = SendAcceleratorToHotTrackedView(); |
1044 if (result == ACCELERATOR_NOT_PROCESSED && | 1048 if (result == ACCELERATOR_NOT_PROCESSED && |
1045 pending_state_.item->enabled()) { | 1049 pending_state_.item->enabled()) { |
1046 Accept(pending_state_.item, 0); | 1050 Accept(pending_state_.item, 0); |
1047 return false; | 1051 return false; |
1048 } else if (result == ACCELERATOR_PROCESSED_EXIT) { | 1052 } else if (result == ACCELERATOR_PROCESSED_EXIT) { |
1049 return false; | 1053 return false; |
1050 } | 1054 } |
1051 } | 1055 } |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2305 } | 2309 } |
2306 } | 2310 } |
2307 | 2311 |
2308 gfx::Screen* MenuController::GetScreen() { | 2312 gfx::Screen* MenuController::GetScreen() { |
2309 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; | 2313 Widget* root = owner_ ? owner_->GetTopLevelWidget() : NULL; |
2310 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) | 2314 return root ? gfx::Screen::GetScreenFor(root->GetNativeView()) |
2311 : gfx::Screen::GetNativeScreen(); | 2315 : gfx::Screen::GetNativeScreen(); |
2312 } | 2316 } |
2313 | 2317 |
2314 } // namespace views | 2318 } // namespace views |
OLD | NEW |