| 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/base/accelerators/accelerator_manager.h" | 5 #include "ui/base/accelerators/accelerator_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Check if we have a priority handler. If not, there's no more work needed. | 112 // Check if we have a priority handler. If not, there's no more work needed. |
| 113 if (!map_iter->second.first) | 113 if (!map_iter->second.first) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 // If the priority handler says it cannot handle the accelerator, we must not | 116 // If the priority handler says it cannot handle the accelerator, we must not |
| 117 // count it as one. | 117 // count it as one. |
| 118 return map_iter->second.second.front()->CanHandleAccelerators(); | 118 return map_iter->second.second.front()->CanHandleAccelerators(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool AcceleratorManager::ShouldHandle(const Accelerator& accelerator) const { | 121 bool AcceleratorManager::ShouldHandle(const Accelerator& accelerator) const { |
| 122 if (accelerator.type() != ET_KEY_RELEASED && | 122 if (accelerator.type() != ET_KEY_RELEASED) |
| 123 accelerator.type() != ET_TRANSLATED_KEY_RELEASE) { | |
| 124 return true; | 123 return true; |
| 125 } | 124 |
| 126 // This check is necessary e.g. not to process the Shift+Alt+ET_KEY_RELEASED | 125 // This check is necessary e.g. not to process the Shift+Alt+ET_KEY_RELEASED |
| 127 // Accelerator for Chrome OS (see ash/accelerators/accelerator_controller.cc) | 126 // Accelerator for Chrome OS (see ash/accelerators/accelerator_controller.cc) |
| 128 // when Shift+Alt+Tab is pressed and then Tab is released. | 127 // when Shift+Alt+Tab is pressed and then Tab is released. |
| 129 if (last_event_type_ == ET_KEY_PRESSED || | 128 return last_event_type_ == ET_KEY_PRESSED; |
| 130 last_event_type_ == ET_TRANSLATED_KEY_PRESS) { | |
| 131 return true; | |
| 132 } | |
| 133 return false; | |
| 134 } | 129 } |
| 135 | 130 |
| 136 } // namespace ui | 131 } // namespace ui |
| OLD | NEW |