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

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

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/resize_shadow.cc ('k') | ash/wm/stacking_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/wm/stacking_controller.h" 5 #include "ash/wm/stacking_controller.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/session_state_delegate.h" 8 #include "ash/session_state_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 21 matching lines...) Expand all
32 32
33 aura::Window* GetContainerById(aura::Window* root, int id) { 33 aura::Window* GetContainerById(aura::Window* root, int id) {
34 return Shell::GetContainer(root, id); 34 return Shell::GetContainer(root, id);
35 } 35 }
36 36
37 bool IsSystemModal(aura::Window* window) { 37 bool IsSystemModal(aura::Window* window) {
38 return window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; 38 return window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM;
39 } 39 }
40 40
41 bool HasTransientParentWindow(const aura::Window* window) { 41 bool HasTransientParentWindow(const aura::Window* window) {
42 return views::corewm::GetTransientParent(window) && 42 return ::wm::GetTransientParent(window) &&
43 views::corewm::GetTransientParent(window)->type() != 43 ::wm::GetTransientParent(window)->type() !=
44 ui::wm::WINDOW_TYPE_UNKNOWN; 44 ui::wm::WINDOW_TYPE_UNKNOWN;
45 } 45 }
46 46
47 internal::AlwaysOnTopController* 47 internal::AlwaysOnTopController*
48 GetAlwaysOnTopController(aura::Window* root_window) { 48 GetAlwaysOnTopController(aura::Window* root_window) {
49 return internal::GetRootWindowController(root_window)-> 49 return internal::GetRootWindowController(root_window)->
50 always_on_top_controller(); 50 always_on_top_controller();
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 //////////////////////////////////////////////////////////////////////////////// 55 ////////////////////////////////////////////////////////////////////////////////
56 // StackingController, public: 56 // StackingController, public:
57 57
58 StackingController::StackingController() { 58 StackingController::StackingController() {
59 } 59 }
60 60
61 StackingController::~StackingController() { 61 StackingController::~StackingController() {
62 } 62 }
63 63
64 //////////////////////////////////////////////////////////////////////////////// 64 ////////////////////////////////////////////////////////////////////////////////
65 // StackingController, aura::client::WindowTreeClient implementation: 65 // StackingController, aura::client::WindowTreeClient implementation:
66 66
67 aura::Window* StackingController::GetDefaultParent(aura::Window* context, 67 aura::Window* StackingController::GetDefaultParent(aura::Window* context,
68 aura::Window* window, 68 aura::Window* window,
69 const gfx::Rect& bounds) { 69 const gfx::Rect& bounds) {
70 aura::Window* target_root = NULL; 70 aura::Window* target_root = NULL;
71 aura::Window* transient_parent = views::corewm::GetTransientParent(window); 71 aura::Window* transient_parent = ::wm::GetTransientParent(window);
72 if (transient_parent) { 72 if (transient_parent) {
73 // Transient window should use the same root as its transient parent. 73 // Transient window should use the same root as its transient parent.
74 target_root = transient_parent->GetRootWindow(); 74 target_root = transient_parent->GetRootWindow();
75 } else { 75 } else {
76 target_root = FindContainerRoot(bounds); 76 target_root = FindContainerRoot(bounds);
77 } 77 }
78 78
79 switch (window->type()) { 79 switch (window->type()) {
80 case ui::wm::WINDOW_TYPE_NORMAL: 80 case ui::wm::WINDOW_TYPE_NORMAL:
81 case ui::wm::WINDOW_TYPE_POPUP: 81 case ui::wm::WINDOW_TYPE_POPUP:
82 if (IsSystemModal(window)) 82 if (IsSystemModal(window))
83 return GetSystemModalContainer(target_root, window); 83 return GetSystemModalContainer(target_root, window);
84 else if (HasTransientParentWindow(window)) 84 else if (HasTransientParentWindow(window))
85 return internal::RootWindowController::GetContainerForWindow( 85 return internal::RootWindowController::GetContainerForWindow(
86 views::corewm::GetTransientParent(window)); 86 ::wm::GetTransientParent(window));
87 return GetAlwaysOnTopController(target_root)->GetContainer(window); 87 return GetAlwaysOnTopController(target_root)->GetContainer(window);
88 case ui::wm::WINDOW_TYPE_CONTROL: 88 case ui::wm::WINDOW_TYPE_CONTROL:
89 return GetContainerById( 89 return GetContainerById(
90 target_root, internal::kShellWindowId_UnparentedControlContainer); 90 target_root, internal::kShellWindowId_UnparentedControlContainer);
91 case ui::wm::WINDOW_TYPE_PANEL: 91 case ui::wm::WINDOW_TYPE_PANEL:
92 if (wm::GetWindowState(window)->panel_attached()) 92 if (wm::GetWindowState(window)->panel_attached())
93 return GetContainerById(target_root, 93 return GetContainerById(target_root,
94 internal::kShellWindowId_PanelContainer); 94 internal::kShellWindowId_PanelContainer);
95 else 95 else
96 return GetAlwaysOnTopController(target_root)->GetContainer(window); 96 return GetAlwaysOnTopController(target_root)->GetContainer(window);
(...skipping 19 matching lines...) Expand all
116 aura::Window* window) const { 116 aura::Window* window) const {
117 DCHECK(IsSystemModal(window)); 117 DCHECK(IsSystemModal(window));
118 118
119 // If screen lock is not active and user session is active, 119 // If screen lock is not active and user session is active,
120 // all modal windows are placed into the normal modal container. 120 // all modal windows are placed into the normal modal container.
121 // In case of missing transient parent (it could happen for alerts from 121 // In case of missing transient parent (it could happen for alerts from
122 // background pages) assume that the window belongs to user session. 122 // background pages) assume that the window belongs to user session.
123 SessionStateDelegate* session_state_delegate = 123 SessionStateDelegate* session_state_delegate =
124 Shell::GetInstance()->session_state_delegate(); 124 Shell::GetInstance()->session_state_delegate();
125 if (!session_state_delegate->IsUserSessionBlocked() || 125 if (!session_state_delegate->IsUserSessionBlocked() ||
126 !views::corewm::GetTransientParent(window)) { 126 !::wm::GetTransientParent(window)) {
127 return GetContainerById(root, 127 return GetContainerById(root,
128 internal::kShellWindowId_SystemModalContainer); 128 internal::kShellWindowId_SystemModalContainer);
129 } 129 }
130 130
131 // Otherwise those that originate from LockScreen container and above are 131 // Otherwise those that originate from LockScreen container and above are
132 // placed in the screen lock modal container. 132 // placed in the screen lock modal container.
133 int window_container_id = 133 int window_container_id =
134 views::corewm::GetTransientParent(window)->parent()->id(); 134 ::wm::GetTransientParent(window)->parent()->id();
135 aura::Window* container = NULL; 135 aura::Window* container = NULL;
136 if (window_container_id < internal::kShellWindowId_LockScreenContainer) { 136 if (window_container_id < internal::kShellWindowId_LockScreenContainer) {
137 container = GetContainerById( 137 container = GetContainerById(
138 root, internal::kShellWindowId_SystemModalContainer); 138 root, internal::kShellWindowId_SystemModalContainer);
139 } else { 139 } else {
140 container = GetContainerById( 140 container = GetContainerById(
141 root, internal::kShellWindowId_LockSystemModalContainer); 141 root, internal::kShellWindowId_LockSystemModalContainer);
142 } 142 }
143 143
144 return container; 144 return container;
145 } 145 }
146 146
147 } // namespace ash 147 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/resize_shadow.cc ('k') | ash/wm/stacking_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698