| 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/focus/focus_manager.h" | 5 #include "ui/views/focus/focus_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (shortcut_handling_suspended()) | 59 if (shortcut_handling_suspended()) |
| 60 return true; | 60 return true; |
| 61 | 61 |
| 62 int modifiers = ui::EF_NONE; | 62 int modifiers = ui::EF_NONE; |
| 63 if (event.IsShiftDown()) | 63 if (event.IsShiftDown()) |
| 64 modifiers |= ui::EF_SHIFT_DOWN; | 64 modifiers |= ui::EF_SHIFT_DOWN; |
| 65 if (event.IsControlDown()) | 65 if (event.IsControlDown()) |
| 66 modifiers |= ui::EF_CONTROL_DOWN; | 66 modifiers |= ui::EF_CONTROL_DOWN; |
| 67 if (event.IsAltDown()) | 67 if (event.IsAltDown()) |
| 68 modifiers |= ui::EF_ALT_DOWN; | 68 modifiers |= ui::EF_ALT_DOWN; |
| 69 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) |
| 70 if (event.IsCommandDown()) |
| 71 modifiers |= ui::EF_COMMAND_DOWN; |
| 72 #endif |
| 69 ui::Accelerator accelerator(event.key_code(), modifiers); | 73 ui::Accelerator accelerator(event.key_code(), modifiers); |
| 70 accelerator.set_type(event.type()); | 74 accelerator.set_type(event.type()); |
| 71 accelerator.set_is_repeat(event.IsRepeat()); | 75 accelerator.set_is_repeat(event.IsRepeat()); |
| 72 | 76 |
| 73 if (event.type() == ui::ET_KEY_PRESSED) { | 77 if (event.type() == ui::ET_KEY_PRESSED) { |
| 74 // If the focused view wants to process the key event as is, let it be. | 78 // If the focused view wants to process the key event as is, let it be. |
| 75 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && | 79 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && |
| 76 !accelerator_manager_->HasPriorityHandler(accelerator)) | 80 !accelerator_manager_->HasPriorityHandler(accelerator)) |
| 77 return true; | 81 return true; |
| 78 | 82 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 589 } |
| 586 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 590 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
| 587 AdvanceFocus(false); | 591 AdvanceFocus(false); |
| 588 return true; | 592 return true; |
| 589 } | 593 } |
| 590 | 594 |
| 591 return false; | 595 return false; |
| 592 } | 596 } |
| 593 | 597 |
| 594 } // namespace views | 598 } // namespace views |
| OLD | NEW |