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 "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 Loading... |
32 aura::Window* GetContainerById(aura::Window* root, int id) { | 32 aura::Window* GetContainerById(aura::Window* root, int id) { |
33 return Shell::GetContainer(root, id); | 33 return Shell::GetContainer(root, id); |
34 } | 34 } |
35 | 35 |
36 bool IsSystemModal(aura::Window* window) { | 36 bool IsSystemModal(aura::Window* window) { |
37 return window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; | 37 return window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; |
38 } | 38 } |
39 | 39 |
40 bool HasTransientParentWindow(aura::Window* window) { | 40 bool HasTransientParentWindow(aura::Window* window) { |
41 return window->transient_parent() && | 41 return window->transient_parent() && |
42 window->transient_parent()->type() != aura::client::WINDOW_TYPE_UNKNOWN; | 42 window->transient_parent()->type() != ui::wm::WINDOW_TYPE_UNKNOWN; |
43 } | 43 } |
44 | 44 |
45 internal::AlwaysOnTopController* | 45 internal::AlwaysOnTopController* |
46 GetAlwaysOnTopController(aura::Window* root_window) { | 46 GetAlwaysOnTopController(aura::Window* root_window) { |
47 return internal::GetRootWindowController(root_window)-> | 47 return internal::GetRootWindowController(root_window)-> |
48 always_on_top_controller(); | 48 always_on_top_controller(); |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
(...skipping 14 matching lines...) Expand all Loading... |
67 const gfx::Rect& bounds) { | 67 const gfx::Rect& bounds) { |
68 aura::Window* target_root = NULL; | 68 aura::Window* target_root = NULL; |
69 if (window->transient_parent()) { | 69 if (window->transient_parent()) { |
70 // Transient window should use the same root as its transient parent. | 70 // Transient window should use the same root as its transient parent. |
71 target_root = window->transient_parent()->GetRootWindow(); | 71 target_root = window->transient_parent()->GetRootWindow(); |
72 } else { | 72 } else { |
73 target_root = FindContainerRoot(bounds); | 73 target_root = FindContainerRoot(bounds); |
74 } | 74 } |
75 | 75 |
76 switch (window->type()) { | 76 switch (window->type()) { |
77 case aura::client::WINDOW_TYPE_NORMAL: | 77 case ui::wm::WINDOW_TYPE_NORMAL: |
78 case aura::client::WINDOW_TYPE_POPUP: | 78 case ui::wm::WINDOW_TYPE_POPUP: |
79 if (IsSystemModal(window)) | 79 if (IsSystemModal(window)) |
80 return GetSystemModalContainer(target_root, window); | 80 return GetSystemModalContainer(target_root, window); |
81 else if (HasTransientParentWindow(window)) | 81 else if (HasTransientParentWindow(window)) |
82 return internal::RootWindowController::GetContainerForWindow( | 82 return internal::RootWindowController::GetContainerForWindow( |
83 window->transient_parent()); | 83 window->transient_parent()); |
84 return GetAlwaysOnTopController(target_root)->GetContainer(window); | 84 return GetAlwaysOnTopController(target_root)->GetContainer(window); |
85 case aura::client::WINDOW_TYPE_CONTROL: | 85 case ui::wm::WINDOW_TYPE_CONTROL: |
86 return GetContainerById( | 86 return GetContainerById( |
87 target_root, internal::kShellWindowId_UnparentedControlContainer); | 87 target_root, internal::kShellWindowId_UnparentedControlContainer); |
88 case aura::client::WINDOW_TYPE_PANEL: | 88 case ui::wm::WINDOW_TYPE_PANEL: |
89 if (wm::GetWindowState(window)->panel_attached()) | 89 if (wm::GetWindowState(window)->panel_attached()) |
90 return GetContainerById(target_root, | 90 return GetContainerById(target_root, |
91 internal::kShellWindowId_PanelContainer); | 91 internal::kShellWindowId_PanelContainer); |
92 else | 92 else |
93 return GetAlwaysOnTopController(target_root)->GetContainer(window); | 93 return GetAlwaysOnTopController(target_root)->GetContainer(window); |
94 case aura::client::WINDOW_TYPE_MENU: | 94 case ui::wm::WINDOW_TYPE_MENU: |
95 return GetContainerById( | 95 return GetContainerById( |
96 target_root, internal::kShellWindowId_MenuContainer); | 96 target_root, internal::kShellWindowId_MenuContainer); |
97 case aura::client::WINDOW_TYPE_TOOLTIP: | 97 case ui::wm::WINDOW_TYPE_TOOLTIP: |
98 return GetContainerById( | 98 return GetContainerById( |
99 target_root, internal::kShellWindowId_DragImageAndTooltipContainer); | 99 target_root, internal::kShellWindowId_DragImageAndTooltipContainer); |
100 default: | 100 default: |
101 NOTREACHED() << "Window " << window->id() | 101 NOTREACHED() << "Window " << window->id() |
102 << " has unhandled type " << window->type(); | 102 << " has unhandled type " << window->type(); |
103 break; | 103 break; |
104 } | 104 } |
105 return NULL; | 105 return NULL; |
106 } | 106 } |
107 | 107 |
(...skipping 26 matching lines...) Expand all Loading... |
134 root, internal::kShellWindowId_SystemModalContainer); | 134 root, internal::kShellWindowId_SystemModalContainer); |
135 } else { | 135 } else { |
136 container = GetContainerById( | 136 container = GetContainerById( |
137 root, internal::kShellWindowId_LockSystemModalContainer); | 137 root, internal::kShellWindowId_LockSystemModalContainer); |
138 } | 138 } |
139 | 139 |
140 return container; | 140 return container; |
141 } | 141 } |
142 | 142 |
143 } // namespace ash | 143 } // namespace ash |
OLD | NEW |