| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // In FocusControllerTests, only the RootWindow has activatable children. | 328 // In FocusControllerTests, only the RootWindow has activatable children. |
| 329 return window->GetRootWindow() == window; | 329 return window->GetRootWindow() == window; |
| 330 } | 330 } |
| 331 bool CanActivateWindow(aura::Window* window) const override { | 331 bool CanActivateWindow(aura::Window* window) const override { |
| 332 // Restricting focus to a non-activatable child window means the activatable | 332 // Restricting focus to a non-activatable child window means the activatable |
| 333 // parent outside the focus restriction is activatable. | 333 // parent outside the focus restriction is activatable. |
| 334 bool can_activate = | 334 bool can_activate = |
| 335 CanFocusOrActivate(window) || window->Contains(focus_restriction_); | 335 CanFocusOrActivate(window) || window->Contains(focus_restriction_); |
| 336 return can_activate ? BaseFocusRules::CanActivateWindow(window) : false; | 336 return can_activate ? BaseFocusRules::CanActivateWindow(window) : false; |
| 337 } | 337 } |
| 338 bool CanFocusWindow(aura::Window* window) const override { | 338 bool CanFocusWindow(aura::Window* window, |
| 339 return CanFocusOrActivate(window) ? | 339 const ui::Event* event) const override { |
| 340 BaseFocusRules::CanFocusWindow(window) : false; | 340 return CanFocusOrActivate(window) |
| 341 ? BaseFocusRules::CanFocusWindow(window, event) |
| 342 : false; |
| 341 } | 343 } |
| 342 aura::Window* GetActivatableWindow(aura::Window* window) const override { | 344 aura::Window* GetActivatableWindow(aura::Window* window) const override { |
| 343 return BaseFocusRules::GetActivatableWindow( | 345 return BaseFocusRules::GetActivatableWindow( |
| 344 CanFocusOrActivate(window) ? window : focus_restriction_); | 346 CanFocusOrActivate(window) ? window : focus_restriction_); |
| 345 } | 347 } |
| 346 aura::Window* GetFocusableWindow(aura::Window* window) const override { | 348 aura::Window* GetFocusableWindow(aura::Window* window) const override { |
| 347 return BaseFocusRules::GetFocusableWindow( | 349 return BaseFocusRules::GetFocusableWindow( |
| 348 CanFocusOrActivate(window) ? window : focus_restriction_); | 350 CanFocusOrActivate(window) ? window : focus_restriction_); |
| 349 } | 351 } |
| 350 aura::Window* GetNextActivatableWindow(aura::Window* ignore) const override { | 352 aura::Window* GetNextActivatableWindow(aura::Window* ignore) const override { |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, StackWindowAtTopOnActivation); | 1319 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, StackWindowAtTopOnActivation); |
| 1318 | 1320 |
| 1319 // See description above TransientChildWindowActivationTest() for details. | 1321 // See description above TransientChildWindowActivationTest() for details. |
| 1320 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, | 1322 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, |
| 1321 TransientChildWindowActivationTest); | 1323 TransientChildWindowActivationTest); |
| 1322 | 1324 |
| 1323 // If a mouse event was handled, it should not activate a window. | 1325 // If a mouse event was handled, it should not activate a window. |
| 1324 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); | 1326 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); |
| 1325 | 1327 |
| 1326 } // namespace wm | 1328 } // namespace wm |
| OLD | NEW |