| 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/wm/core/focus_controller.h" | 5 #include "ui/wm/core/focus_controller.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
| 9 #include "ui/aura/client/capture_client.h" | 9 #include "ui/aura/client/capture_client.h" |
| 10 #include "ui/aura/client/focus_change_observer.h" | 10 #include "ui/aura/client/focus_change_observer.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 event->details().touch_points() == 1 && | 171 event->details().touch_points() == 1 && |
| 172 !event->handled()) { | 172 !event->handled()) { |
| 173 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target())); | 173 WindowFocusedFromInputEvent(static_cast<aura::Window*>(event->target())); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 //////////////////////////////////////////////////////////////////////////////// | 177 //////////////////////////////////////////////////////////////////////////////// |
| 178 // FocusController, aura::WindowObserver implementation: | 178 // FocusController, aura::WindowObserver implementation: |
| 179 | 179 |
| 180 void FocusController::OnWindowVisibilityChanged(aura::Window* window, | 180 void FocusController::OnWindowVisibilityChanged(aura::Window* window, |
| 181 bool visible) { | 181 bool visible, |
| 182 bool content_visible) { |
| 182 if (!visible) | 183 if (!visible) |
| 183 WindowLostFocusFromDispositionChange(window, window->parent()); | 184 WindowLostFocusFromDispositionChange(window, window->parent()); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void FocusController::OnWindowDestroying(aura::Window* window) { | 187 void FocusController::OnWindowDestroying(aura::Window* window) { |
| 187 // A window's modality state will interfere with focus restoration during its | 188 // A window's modality state will interfere with focus restoration during its |
| 188 // destruction. | 189 // destruction. |
| 189 window->ClearProperty(aura::client::kModalKey); | 190 window->ClearProperty(aura::client::kModalKey); |
| 190 WindowLostFocusFromDispositionChange(window, window->parent()); | 191 WindowLostFocusFromDispositionChange(window, window->parent()); |
| 191 } | 192 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 347 |
| 347 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { | 348 void FocusController::WindowFocusedFromInputEvent(aura::Window* window) { |
| 348 // Only focus |window| if it or any of its parents can be focused. Otherwise | 349 // Only focus |window| if it or any of its parents can be focused. Otherwise |
| 349 // FocusWindow() will focus the topmost window, which may not be the | 350 // FocusWindow() will focus the topmost window, which may not be the |
| 350 // currently focused one. | 351 // currently focused one. |
| 351 if (rules_->CanFocusWindow(GetToplevelWindow(window))) | 352 if (rules_->CanFocusWindow(GetToplevelWindow(window))) |
| 352 FocusWindow(window); | 353 FocusWindow(window); |
| 353 } | 354 } |
| 354 | 355 |
| 355 } // namespace wm | 356 } // namespace wm |
| OLD | NEW |