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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ui::Accelerator accelerator(event.key_code(), modifiers); | 69 ui::Accelerator accelerator(event.key_code(), modifiers); |
70 accelerator.set_type(event.type()); | 70 accelerator.set_type(event.type()); |
| 71 accelerator.set_is_repeat(event.IsRepeat()); |
71 | 72 |
72 if (event.type() == ui::ET_KEY_PRESSED) { | 73 if (event.type() == ui::ET_KEY_PRESSED) { |
73 // If the focused view wants to process the key event as is, let it be. | 74 // If the focused view wants to process the key event as is, let it be. |
74 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && | 75 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && |
75 !accelerator_manager_->HasPriorityHandler(accelerator)) | 76 !accelerator_manager_->HasPriorityHandler(accelerator)) |
76 return true; | 77 return true; |
77 | 78 |
78 // Intercept Tab related messages for focus traversal. | 79 // Intercept Tab related messages for focus traversal. |
79 // Note that we don't do focus traversal if the root window is not part of | 80 // Note that we don't do focus traversal if the root window is not part of |
80 // the active window hierarchy as this would mean we have no focused view | 81 // the active window hierarchy as this would mean we have no focused view |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 } | 580 } |
580 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 581 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
581 AdvanceFocus(false); | 582 AdvanceFocus(false); |
582 return true; | 583 return true; |
583 } | 584 } |
584 | 585 |
585 return false; | 586 return false; |
586 } | 587 } |
587 | 588 |
588 } // namespace views | 589 } // namespace views |
OLD | NEW |