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/display/display_controller.h" | 7 #include "ash/display/display_controller.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/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
11 #include "ash/wm/always_on_top_controller.h" | 11 #include "ash/wm/always_on_top_controller.h" |
12 #include "ash/wm/coordinate_conversion.h" | 12 #include "ash/wm/coordinate_conversion.h" |
13 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/window_properties.h" |
14 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
15 #include "ui/aura/root_window.h" | 15 #include "ui/aura/root_window.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/base/ui_base_types.h" | 17 #include "ui/base/ui_base_types.h" |
18 | 18 |
19 namespace ash { | 19 namespace ash { |
20 namespace internal { | |
21 namespace { | 20 namespace { |
22 | 21 |
23 // Find a root window that matches the |bounds|. If the virtual screen | 22 // Find a root window that matches the |bounds|. If the virtual screen |
24 // coordinates is enabled and the bounds is specified, the root window | 23 // coordinates is enabled and the bounds is specified, the root window |
25 // that matches the window's bound will be used. Otherwise, it'll | 24 // that matches the window's bound will be used. Otherwise, it'll |
26 // return the active root window. | 25 // return the active root window. |
27 aura::RootWindow* FindContainerRoot(const gfx::Rect& bounds) { | 26 aura::RootWindow* FindContainerRoot(const gfx::Rect& bounds) { |
28 if (bounds.x() == 0 && bounds.y() == 0 && bounds.IsEmpty()) | 27 if (bounds.x() == 0 && bounds.y() == 0 && bounds.IsEmpty()) |
29 return Shell::GetActiveRootWindow(); | 28 return Shell::GetActiveRootWindow(); |
30 return wm::GetRootWindowMatching(bounds); | 29 return wm::GetRootWindowMatching(bounds); |
(...skipping 18 matching lines...) Expand all Loading... |
49 return window->transient_parent() && | 48 return window->transient_parent() && |
50 window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW; | 49 window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_WINDOW; |
51 } | 50 } |
52 | 51 |
53 } // namespace | 52 } // namespace |
54 | 53 |
55 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
56 // StackingController, public: | 55 // StackingController, public: |
57 | 56 |
58 StackingController::StackingController() { | 57 StackingController::StackingController() { |
59 aura::client::SetStackingClient(this); | |
60 } | 58 } |
61 | 59 |
62 StackingController::~StackingController() { | 60 StackingController::~StackingController() { |
63 } | 61 } |
64 | 62 |
65 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
66 // StackingController, aura::StackingClient implementation: | 64 // StackingController, aura::StackingClient implementation: |
67 | 65 |
68 aura::Window* StackingController::GetDefaultParent(aura::Window* window, | 66 aura::Window* StackingController::GetDefaultParent(aura::Window* context, |
| 67 aura::Window* window, |
69 const gfx::Rect& bounds) { | 68 const gfx::Rect& bounds) { |
70 aura::RootWindow* target_root = NULL; | 69 aura::RootWindow* target_root = NULL; |
71 if (window->transient_parent()) { | 70 if (window->transient_parent()) { |
72 // Transient window should use the same root as its transient parent. | 71 // Transient window should use the same root as its transient parent. |
73 target_root = window->transient_parent()->GetRootWindow(); | 72 target_root = window->transient_parent()->GetRootWindow(); |
74 } else { | 73 } else { |
75 target_root = FindContainerRoot(bounds); | 74 target_root = FindContainerRoot(bounds); |
76 } | 75 } |
77 | 76 |
78 switch (window->type()) { | 77 switch (window->type()) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 internal::AlwaysOnTopController* | 140 internal::AlwaysOnTopController* |
142 StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) { | 141 StackingController::GetAlwaysOnTopController(aura::RootWindow* root_window) { |
143 internal::AlwaysOnTopController* controller = | 142 internal::AlwaysOnTopController* controller = |
144 root_window->GetProperty(internal::kAlwaysOnTopControllerKey); | 143 root_window->GetProperty(internal::kAlwaysOnTopControllerKey); |
145 if (!controller) { | 144 if (!controller) { |
146 controller = new internal::AlwaysOnTopController; | 145 controller = new internal::AlwaysOnTopController; |
147 controller->SetAlwaysOnTopContainer( | 146 controller->SetAlwaysOnTopContainer( |
148 root_window->GetChildById( | 147 root_window->GetChildById( |
149 internal::kShellWindowId_AlwaysOnTopContainer)); | 148 internal::kShellWindowId_AlwaysOnTopContainer)); |
150 // RootWindow owns the AlwaysOnTopController object. | 149 // RootWindow owns the AlwaysOnTopController object. |
151 root_window->SetProperty(kAlwaysOnTopControllerKey, controller); | 150 root_window->SetProperty(internal::kAlwaysOnTopControllerKey, controller); |
152 } | 151 } |
153 return controller; | 152 return controller; |
154 } | 153 } |
155 | 154 |
156 } // namespace internal | |
157 } // namespace ash | 155 } // namespace ash |
OLD | NEW |