OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ash/wm/focus_rules.h" | 5 #include "ash/wm/focus_rules.h" |
6 | 6 |
7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
11 #include "ash/wm_window.h" | 11 #include "ash/wm_window.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 bool IsToplevelWindow(WmWindow* window) { | 15 bool IsToplevelWindow(WmWindow* window) { |
16 DCHECK(window); | 16 DCHECK(window); |
17 // The window must in a valid hierarchy. | 17 // The window must in a valid hierarchy. |
18 if (!window->GetRootWindow()) | 18 if (!window->GetRootWindow()) |
19 return false; | 19 return false; |
20 | 20 |
21 // The window must exist within a container that supports activation. | 21 // The window must exist within a container that supports activation. |
22 // The window cannot be blocked by a modal transient. | 22 // The window cannot be blocked by a modal transient. |
23 return IsActivatableShellWindowId(window->GetParent()->GetShellWindowId()); | 23 return IsActivatableShellWindowId(window->GetParent()->aura_window()->id()); |
24 } | 24 } |
25 | 25 |
26 bool IsWindowConsideredActivatable(WmWindow* window) { | 26 bool IsWindowConsideredActivatable(WmWindow* window) { |
27 DCHECK(window); | 27 DCHECK(window); |
28 // Only toplevel windows can be activated. | 28 // Only toplevel windows can be activated. |
29 if (!IsToplevelWindow(window)) | 29 if (!IsToplevelWindow(window)) |
30 return false; | 30 return false; |
31 | 31 |
32 // The window must be visible. | 32 // The window must be visible. |
33 return IsWindowConsideredVisibleForActivation(window); | 33 return IsWindowConsideredVisibleForActivation(window); |
(...skipping 10 matching lines...) Expand all Loading... |
44 return true; | 44 return true; |
45 | 45 |
46 // Minimized windows are hidden in their minimized state, but they can always | 46 // Minimized windows are hidden in their minimized state, but they can always |
47 // be activated. | 47 // be activated. |
48 if (window->GetWindowState()->IsMinimized()) | 48 if (window->GetWindowState()->IsMinimized()) |
49 return true; | 49 return true; |
50 | 50 |
51 if (!window->GetTargetVisibility()) | 51 if (!window->GetTargetVisibility()) |
52 return false; | 52 return false; |
53 | 53 |
54 const int parent_shell_window_id = window->GetParent()->GetShellWindowId(); | 54 const int parent_shell_window_id = window->GetParent()->aura_window()->id(); |
55 return parent_shell_window_id == kShellWindowId_DefaultContainer || | 55 return parent_shell_window_id == kShellWindowId_DefaultContainer || |
56 parent_shell_window_id == kShellWindowId_LockScreenContainer; | 56 parent_shell_window_id == kShellWindowId_LockScreenContainer; |
57 } | 57 } |
58 | 58 |
59 } // namespace ash | 59 } // namespace ash |
OLD | NEW |