Chromium Code Reviews| Index: ash/wm/activation_controller.cc |
| diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc |
| index 1d35998d9e7269b007f05244afdc7bdce1e970d0..8995a23730347006245fd4f510d31d34588b7534 100644 |
| --- a/ash/wm/activation_controller.cc |
| +++ b/ash/wm/activation_controller.cc |
| @@ -55,6 +55,17 @@ bool SupportsChildActivation(aura::Window* window) { |
| return false; |
| } |
| +bool HasModalTransientChild(aura::Window* window) { |
| + aura::Window::Windows::const_iterator it; |
| + for (it = window->transient_children().begin(); |
| + it != window->transient_children().end(); |
| + ++it) { |
| + if ((*it)->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| // Returns true if |window| can be activated or deactivated. |
| // A window manager typically defines some notion of "top level window" that |
| // supports activation/deactivation. |
| @@ -62,8 +73,9 @@ bool CanActivateWindow(aura::Window* window, const aura::Event* event) { |
| return window && |
| window->IsVisible() && |
| (!aura::client::GetActivationDelegate(window) || |
| - aura::client::GetActivationDelegate(window)->ShouldActivate(event)) && |
| - SupportsChildActivation(window->parent()); |
| + !event || |
|
sky
2012/03/27 14:59:58
Why are you adding the '!event' clause? It is lega
yoshiki
2012/03/28 15:08:41
Done. Un-changed.
|
| + aura::client::GetActivationDelegate(window)->ShouldActivate(event)) && |
| + SupportsChildActivation(window->parent()); |
|
sky
2012/03/27 14:59:58
fix indentation.
yoshiki
2012/03/28 15:08:41
Done.
|
| } |
| // When a modal window is activated, we bring its entire transient parent chain |
| @@ -116,6 +128,10 @@ aura::Window* ActivationController::GetActivatableWindow( |
| return NULL; |
| } |
| +bool ActivationController::CanActivateWindowItself(aura::Window* window) { |
| + return CanActivateWindow(window, NULL) && !HasModalTransientChild(window); |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // ActivationController, aura::client::ActivationClient implementation: |