OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/stacking_controller.h" | 5 #include "ui/aura_shell/stacking_controller.h" |
6 | 6 |
| 7 #include "ui/aura/client/aura_constants.h" |
7 #include "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
8 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
9 #include "ui/aura_shell/always_on_top_controller.h" | 10 #include "ui/aura_shell/always_on_top_controller.h" |
10 #include "ui/aura_shell/shell.h" | 11 #include "ui/aura_shell/shell.h" |
11 #include "ui/aura_shell/shell_window_ids.h" | 12 #include "ui/aura_shell/shell_window_ids.h" |
12 | 13 |
13 namespace aura_shell { | 14 namespace aura_shell { |
14 namespace internal { | 15 namespace internal { |
15 namespace { | 16 namespace { |
16 | 17 |
17 aura::Window* GetContainer(int id) { | 18 aura::Window* GetContainer(int id) { |
18 return Shell::GetInstance()->GetContainer(id); | 19 return Shell::GetInstance()->GetContainer(id); |
19 } | 20 } |
20 | 21 |
21 // Returns true if children of |window| can be activated. | 22 // Returns true if children of |window| can be activated. |
22 bool SupportsChildActivation(aura::Window* window) { | 23 bool SupportsChildActivation(aura::Window* window) { |
23 return window->id() == kShellWindowId_DefaultContainer || | 24 return window->id() == kShellWindowId_DefaultContainer || |
24 window->id() == kShellWindowId_AlwaysOnTopContainer; | 25 window->id() == kShellWindowId_AlwaysOnTopContainer || |
| 26 window->id() == kShellWindowId_ModalContainer; |
| 27 } |
| 28 |
| 29 bool IsWindowModal(aura::Window* window) { |
| 30 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); |
25 } | 31 } |
26 | 32 |
27 } // namespace | 33 } // namespace |
28 | 34 |
29 //////////////////////////////////////////////////////////////////////////////// | 35 //////////////////////////////////////////////////////////////////////////////// |
30 // StackingController, public: | 36 // StackingController, public: |
31 | 37 |
32 StackingController::StackingController() { | 38 StackingController::StackingController() { |
33 aura::Desktop::GetInstance()->SetStackingClient(this); | 39 aura::Desktop::GetInstance()->SetStackingClient(this); |
34 } | 40 } |
(...skipping 26 matching lines...) Expand all Loading... |
61 } | 67 } |
62 | 68 |
63 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
64 // StackingController, aura::StackingClient implementation: | 70 // StackingController, aura::StackingClient implementation: |
65 | 71 |
66 void StackingController::AddChildToDefaultParent(aura::Window* window) { | 72 void StackingController::AddChildToDefaultParent(aura::Window* window) { |
67 aura::Window* parent = NULL; | 73 aura::Window* parent = NULL; |
68 switch (window->type()) { | 74 switch (window->type()) { |
69 case aura::WINDOW_TYPE_NORMAL: | 75 case aura::WINDOW_TYPE_NORMAL: |
70 case aura::WINDOW_TYPE_POPUP: | 76 case aura::WINDOW_TYPE_POPUP: |
| 77 if (IsWindowModal(window)) { |
| 78 parent = GetContainer(internal::kShellWindowId_ModalContainer); |
| 79 break; |
| 80 } |
71 parent = always_on_top_controller_->GetContainer(window); | 81 parent = always_on_top_controller_->GetContainer(window); |
72 break; | 82 break; |
73 case aura::WINDOW_TYPE_MENU: | 83 case aura::WINDOW_TYPE_MENU: |
74 case aura::WINDOW_TYPE_TOOLTIP: | 84 case aura::WINDOW_TYPE_TOOLTIP: |
75 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); | 85 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); |
76 break; | 86 break; |
77 default: | 87 default: |
78 NOTREACHED() << "Window " << window->id() | 88 NOTREACHED() << "Window " << window->id() |
79 << " has unhandled type " << window->type(); | 89 << " has unhandled type " << window->type(); |
80 break; | 90 break; |
(...skipping 17 matching lines...) Expand all Loading... |
98 } | 108 } |
99 return NULL; | 109 return NULL; |
100 } | 110 } |
101 | 111 |
102 | 112 |
103 //////////////////////////////////////////////////////////////////////////////// | 113 //////////////////////////////////////////////////////////////////////////////// |
104 // StackingController, private: | 114 // StackingController, private: |
105 | 115 |
106 } // namespace internal | 116 } // namespace internal |
107 } // namespace aura_shell | 117 } // namespace aura_shell |
OLD | NEW |