Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: ash/wm/focus_rules.cc

Issue 2895713002: [mus+ash] Removes WmWindow from ash/wm/mru_window_tracker and overview mode (Closed)
Patch Set: Address nits, unit_tests target compiles Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ui/aura/window.h"
12 13
13 namespace ash { 14 namespace ash {
14 15
15 bool IsToplevelWindow(WmWindow* window) { 16 bool IsToplevelWindow(aura::Window* window) {
16 DCHECK(window); 17 DCHECK(window);
17 // The window must in a valid hierarchy. 18 // The window must in a valid hierarchy.
18 if (!window->GetRootWindow()) 19 if (!window->GetRootWindow())
19 return false; 20 return false;
20 21
21 // The window must exist within a container that supports activation. 22 // The window must exist within a container that supports activation.
22 // The window cannot be blocked by a modal transient. 23 // The window cannot be blocked by a modal transient.
23 return IsActivatableShellWindowId(window->GetParent()->aura_window()->id()); 24 return IsActivatableShellWindowId(window->parent()->id());
24 } 25 }
25 26
26 bool IsWindowConsideredActivatable(WmWindow* window) { 27 bool IsWindowConsideredActivatable(aura::Window* window) {
27 DCHECK(window); 28 DCHECK(window);
28 // Only toplevel windows can be activated. 29 // Only toplevel windows can be activated.
29 if (!IsToplevelWindow(window)) 30 if (!IsToplevelWindow(window))
30 return false; 31 return false;
31 32
32 // The window must be visible. 33 // The window must be visible.
33 return IsWindowConsideredVisibleForActivation(window); 34 return IsWindowConsideredVisibleForActivation(window);
34 } 35 }
35 36
36 bool IsWindowConsideredVisibleForActivation(WmWindow* window) { 37 bool IsWindowConsideredVisibleForActivation(aura::Window* window) {
37 DCHECK(window); 38 DCHECK(window);
38 // If the |window| doesn't belong to the current active user and also doesn't 39 // If the |window| doesn't belong to the current active user and also doesn't
39 // show for the current active user, then it should not be activated. 40 // show for the current active user, then it should not be activated.
40 if (!Shell::Get()->shell_delegate()->CanShowWindowForUser(window)) 41 if (!Shell::Get()->shell_delegate()->CanShowWindowForUser(
42 WmWindow::Get(window)))
41 return false; 43 return false;
42 44
43 if (window->IsVisible()) 45 if (window->IsVisible())
44 return true; 46 return true;
45 47
46 // Minimized windows are hidden in their minimized state, but they can always 48 // Minimized windows are hidden in their minimized state, but they can always
47 // be activated. 49 // be activated.
48 if (window->GetWindowState()->IsMinimized()) 50 if (wm::GetWindowState(window)->IsMinimized())
49 return true; 51 return true;
50 52
51 if (!window->GetTargetVisibility()) 53 if (!window->TargetVisibility())
52 return false; 54 return false;
53 55
54 const int parent_shell_window_id = window->GetParent()->aura_window()->id(); 56 const int parent_shell_window_id = window->parent()->id();
55 return parent_shell_window_id == kShellWindowId_DefaultContainer || 57 return parent_shell_window_id == kShellWindowId_DefaultContainer ||
56 parent_shell_window_id == kShellWindowId_LockScreenContainer; 58 parent_shell_window_id == kShellWindowId_LockScreenContainer;
57 } 59 }
58 60
59 } // namespace ash 61 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698