OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/focus/focus_manager.h" | 5 #include "views/focus/focus_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // On Linux we always dispatch key events to the focused view first, so | 83 // On Linux we always dispatch key events to the focused view first, so |
84 // we should not do this check here. See also NativeWidgetGtk::OnKeyEvent(). | 84 // we should not do this check here. See also NativeWidgetGtk::OnKeyEvent(). |
85 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event)) | 85 if (focused_view_ && focused_view_->SkipDefaultKeyEventProcessing(event)) |
86 return true; | 86 return true; |
87 #endif | 87 #endif |
88 | 88 |
89 // Intercept Tab related messages for focus traversal. | 89 // Intercept Tab related messages for focus traversal. |
90 // 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 |
91 // 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 |
92 // would focus the first focusable view. | 92 // would focus the first focusable view. |
93 #if defined(OS_WIN) | 93 #if defined(OS_WIN) && !defined(USE_AURA) |
94 HWND top_window = widget_->GetNativeView(); | 94 HWND top_window = widget_->GetNativeView(); |
95 HWND active_window = ::GetActiveWindow(); | 95 HWND active_window = ::GetActiveWindow(); |
96 if ((active_window == top_window || ::IsChild(active_window, top_window)) && | 96 if ((active_window == top_window || ::IsChild(active_window, top_window)) && |
97 IsTabTraversalKeyEvent(event)) { | 97 IsTabTraversalKeyEvent(event)) { |
98 AdvanceFocus(event.IsShiftDown()); | 98 AdvanceFocus(event.IsShiftDown()); |
99 return false; | 99 return false; |
100 } | 100 } |
101 #else | 101 #else |
102 if (IsTabTraversalKeyEvent(event)) { | 102 if (IsTabTraversalKeyEvent(event)) { |
103 AdvanceFocus(event.IsShiftDown()); | 103 AdvanceFocus(event.IsShiftDown()); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 477 |
478 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { | 478 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { |
479 focus_change_listeners_.AddObserver(listener); | 479 focus_change_listeners_.AddObserver(listener); |
480 } | 480 } |
481 | 481 |
482 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { | 482 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { |
483 focus_change_listeners_.RemoveObserver(listener); | 483 focus_change_listeners_.RemoveObserver(listener); |
484 } | 484 } |
485 | 485 |
486 } // namespace views | 486 } // namespace views |
OLD | NEW |