| 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/corewm/focus_controller.h" | 5 #include "ui/views/corewm/focus_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ui/aura/client/activation_change_observer.h" | 9 #include "ui/aura/client/activation_change_observer.h" |
| 10 #include "ui/aura/client/activation_client.h" | 10 #include "ui/aura/client/activation_client.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 EXPECT_EQ(focus_changed_count, focus_changed_count_); | 36 EXPECT_EQ(focus_changed_count, focus_changed_count_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 // Overridden from aura::client::ActivationChangeObserver: | 41 // Overridden from aura::client::ActivationChangeObserver: |
| 42 virtual void OnWindowActivated(aura::Window* gained_active, | 42 virtual void OnWindowActivated(aura::Window* gained_active, |
| 43 aura::Window* lost_active) OVERRIDE { | 43 aura::Window* lost_active) OVERRIDE { |
| 44 ++activation_changed_count_; | 44 ++activation_changed_count_; |
| 45 } | 45 } |
| 46 virtual void OnWindowActivationRequestCompleted( |
| 47 aura::Window* request_active, aura::Window* actual_active) OVERRIDE { |
| 48 } |
| 46 | 49 |
| 47 // Overridden from aura::client::FocusChangeObserver: | 50 // Overridden from aura::client::FocusChangeObserver: |
| 48 virtual void OnWindowFocused(aura::Window* gained_focus, | 51 virtual void OnWindowFocused(aura::Window* gained_focus, |
| 49 aura::Window* lost_focus) OVERRIDE { | 52 aura::Window* lost_focus) OVERRIDE { |
| 50 ++focus_changed_count_; | 53 ++focus_changed_count_; |
| 51 } | 54 } |
| 52 | 55 |
| 53 int activation_changed_count_; | 56 int activation_changed_count_; |
| 54 int focus_changed_count_; | 57 int focus_changed_count_; |
| 55 | 58 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 virtual void OnWindowActivated(aura::Window* gained_active, | 116 virtual void OnWindowActivated(aura::Window* gained_active, |
| 114 aura::Window* lost_active) OVERRIDE { | 117 aura::Window* lost_active) OVERRIDE { |
| 115 // Shift focus to a child. This should prevent the default focusing from | 118 // Shift focus to a child. This should prevent the default focusing from |
| 116 // occurring in FocusController::FocusWindow(). | 119 // occurring in FocusController::FocusWindow(). |
| 117 if (gained_active == activated_window_) { | 120 if (gained_active == activated_window_) { |
| 118 aura::client::FocusClient* client = | 121 aura::client::FocusClient* client = |
| 119 aura::client::GetFocusClient(gained_active); | 122 aura::client::GetFocusClient(gained_active); |
| 120 client->FocusWindow(shift_focus_to_); | 123 client->FocusWindow(shift_focus_to_); |
| 121 } | 124 } |
| 122 } | 125 } |
| 126 virtual void OnWindowActivationRequestCompleted( |
| 127 aura::Window* request_active, aura::Window* actual_active) OVERRIDE { |
| 128 } |
| 123 | 129 |
| 124 aura::Window* activated_window_; | 130 aura::Window* activated_window_; |
| 125 aura::Window* shift_focus_to_; | 131 aura::Window* shift_focus_to_; |
| 126 | 132 |
| 127 DISALLOW_COPY_AND_ASSIGN(FocusShiftingActivationObserver); | 133 DISALLOW_COPY_AND_ASSIGN(FocusShiftingActivationObserver); |
| 128 }; | 134 }; |
| 129 | 135 |
| 130 // BaseFocusRules subclass that allows basic overrides of focus/activation to | 136 // BaseFocusRules subclass that allows basic overrides of focus/activation to |
| 131 // be tested. This is intended more as a test that the override system works at | 137 // be tested. This is intended more as a test that the override system works at |
| 132 // all, rather than as an exhaustive set of use cases, those should be covered | 138 // all, rather than as an exhaustive set of use cases, those should be covered |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 // activation change observer are ignored. | 956 // activation change observer are ignored. |
| 951 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivation); | 957 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivation); |
| 952 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivationDueToHide); | 958 DIRECT_FOCUS_CHANGE_TESTS(ShiftFocusOnActivationDueToHide); |
| 953 DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); | 959 DIRECT_FOCUS_CHANGE_TESTS(NoShiftActiveOnActivation); |
| 954 | 960 |
| 955 // Clicking on a window which has capture should not result in a focus change. | 961 // Clicking on a window which has capture should not result in a focus change. |
| 956 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); | 962 DIRECT_FOCUS_CHANGE_TESTS(NoFocusChangeOnClickOnCaptureWindow); |
| 957 | 963 |
| 958 } // namespace corewm | 964 } // namespace corewm |
| 959 } // namespace views | 965 } // namespace views |
| OLD | NEW |