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, ui::Event* event) const override { |
339 return CanFocusOrActivate(window) ? | 339 return CanFocusOrActivate(window) |
340 BaseFocusRules::CanFocusWindow(window) : false; | 340 ? BaseFocusRules::CanFocusWindow(window, event) |
| 341 : false; |
341 } | 342 } |
342 aura::Window* GetActivatableWindow(aura::Window* window) const override { | 343 aura::Window* GetActivatableWindow(aura::Window* window) const override { |
343 return BaseFocusRules::GetActivatableWindow( | 344 return BaseFocusRules::GetActivatableWindow( |
344 CanFocusOrActivate(window) ? window : focus_restriction_); | 345 CanFocusOrActivate(window) ? window : focus_restriction_); |
345 } | 346 } |
346 aura::Window* GetFocusableWindow(aura::Window* window) const override { | 347 aura::Window* GetFocusableWindow(aura::Window* window) const override { |
347 return BaseFocusRules::GetFocusableWindow( | 348 return BaseFocusRules::GetFocusableWindow( |
348 CanFocusOrActivate(window) ? window : focus_restriction_); | 349 CanFocusOrActivate(window) ? window : focus_restriction_); |
349 } | 350 } |
350 aura::Window* GetNextActivatableWindow(aura::Window* ignore) const override { | 351 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); | 1318 FOCUS_CONTROLLER_TEST(FocusControllerApiTest, StackWindowAtTopOnActivation); |
1318 | 1319 |
1319 // See description above TransientChildWindowActivationTest() for details. | 1320 // See description above TransientChildWindowActivationTest() for details. |
1320 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, | 1321 FOCUS_CONTROLLER_TEST(FocusControllerParentHideTest, |
1321 TransientChildWindowActivationTest); | 1322 TransientChildWindowActivationTest); |
1322 | 1323 |
1323 // If a mouse event was handled, it should not activate a window. | 1324 // If a mouse event was handled, it should not activate a window. |
1324 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); | 1325 FOCUS_CONTROLLER_TEST(FocusControllerMouseEventTest, IgnoreHandledEvent); |
1325 | 1326 |
1326 } // namespace wm | 1327 } // namespace wm |
OLD | NEW |