| 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/aura/desktop/desktop_activation_client.h" | 5 #include "ui/aura/desktop/desktop_activation_client.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "ui/aura/client/activation_delegate.h" | 8 #include "ui/aura/client/activation_delegate.h" |
| 9 #include "ui/aura/focus_manager.h" | 9 #include "ui/aura/focus_manager.h" |
| 10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if (window == current_active_) | 59 if (window == current_active_) |
| 60 current_active_ = NULL; | 60 current_active_ = NULL; |
| 61 } | 61 } |
| 62 | 62 |
| 63 aura::Window* DesktopActivationClient::GetActiveWindow() { | 63 aura::Window* DesktopActivationClient::GetActiveWindow() { |
| 64 return current_active_; | 64 return current_active_; |
| 65 } | 65 } |
| 66 | 66 |
| 67 bool DesktopActivationClient::OnWillFocusWindow(Window* window, | 67 bool DesktopActivationClient::OnWillFocusWindow(Window* window, |
| 68 const Event* event) { | 68 const Event* event) { |
| 69 // TODO(erg): Is this OK? Logic is much more nuanced in ash. | 69 return CanActivateWindow(window); |
| 70 return true; | |
| 71 } | 70 } |
| 72 | 71 |
| 73 void DesktopActivationClient::OnWindowFocused(aura::Window* window) { | 72 void DesktopActivationClient::OnWindowFocused(aura::Window* window) { |
| 74 ActivateWindow(GetActivatableWindow(window)); | 73 ActivateWindow(GetActivatableWindow(window)); |
| 75 } | 74 } |
| 76 | 75 |
| 77 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { | 76 bool DesktopActivationClient::CanActivateWindow(aura::Window* window) const { |
| 78 return window && | 77 return window && |
| 79 window->IsVisible() && | 78 window->IsVisible() && |
| 80 (!aura::client::GetActivationDelegate(window) || | 79 (!aura::client::GetActivationDelegate(window) || |
| (...skipping 11 matching lines...) Expand all Loading... |
| 92 // that path instead. | 91 // that path instead. |
| 93 if (child->transient_parent()) | 92 if (child->transient_parent()) |
| 94 return GetActivatableWindow(child->transient_parent()); | 93 return GetActivatableWindow(child->transient_parent()); |
| 95 parent = parent->parent(); | 94 parent = parent->parent(); |
| 96 child = child->parent(); | 95 child = child->parent(); |
| 97 } | 96 } |
| 98 return NULL; | 97 return NULL; |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace aura | 100 } // namespace aura |
| OLD | NEW |