| 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 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 return false; | 73 return false; |
| 74 #endif | 74 #endif |
| 75 | 75 |
| 76 ui::Accelerator accelerator(event.key_code(), | 76 ui::Accelerator accelerator(event.key_code(), |
| 77 event.IsShiftDown(), | 77 event.IsShiftDown(), |
| 78 event.IsControlDown(), | 78 event.IsControlDown(), |
| 79 event.IsAltDown()); | 79 event.IsAltDown()); |
| 80 | 80 |
| 81 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
| 82 // If the focused view wants to process the key event as is, let it be. | 82 // If the focused view wants to process the key event as is, let it be. |
| 83 // On Linux we always dispatch key events to the focused view first, so | 83 // This is not used for linux/aura. |
| 84 // we should not do this check here. See also NativeWidgetGtk::OnKeyEvent(). | |
| 85 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && | 84 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event) && |
| 86 !accelerator_manager_->HasPriorityHandler(accelerator)) | 85 !accelerator_manager_->HasPriorityHandler(accelerator)) |
| 87 return true; | 86 return true; |
| 88 #endif | 87 #endif |
| 89 | 88 |
| 90 // Intercept Tab related messages for focus traversal. | 89 // Intercept Tab related messages for focus traversal. |
| 91 // Note that we don't do focus traversal if the root window is not part of the | 90 // Note that we don't do focus traversal if the root window is not part of the |
| 92 // active window hierarchy as this would mean we have no focused view and | 91 // active window hierarchy as this would mean we have no focused view and |
| 93 // would focus the first focusable view. | 92 // would focus the first focusable view. |
| 94 #if defined(OS_WIN) && !defined(USE_AURA) | 93 #if defined(OS_WIN) && !defined(USE_AURA) |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 460 |
| 462 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { | 461 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { |
| 463 focus_change_listeners_.AddObserver(listener); | 462 focus_change_listeners_.AddObserver(listener); |
| 464 } | 463 } |
| 465 | 464 |
| 466 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { | 465 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { |
| 467 focus_change_listeners_.RemoveObserver(listener); | 466 focus_change_listeners_.RemoveObserver(listener); |
| 468 } | 467 } |
| 469 | 468 |
| 470 } // namespace views | 469 } // namespace views |
| OLD | NEW |