Chromium Code Reviews| 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/client/aura_constants.h" |
| 8 #include "ui/aura/desktop.h" | 8 #include "ui/aura/desktop.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura_shell/always_on_top_controller.h" | 10 #include "ui/aura_shell/always_on_top_controller.h" |
| 11 #include "ui/aura_shell/shell.h" | 11 #include "ui/aura_shell/shell.h" |
| 12 #include "ui/aura_shell/shell_window_ids.h" | 12 #include "ui/aura_shell/shell_window_ids.h" |
| 13 | 13 |
| 14 namespace aura_shell { | 14 namespace aura_shell { |
| 15 namespace internal { | 15 namespace internal { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 aura::Window* GetContainer(int id) { | 18 aura::Window* GetContainer(int id) { |
| 19 return Shell::GetInstance()->GetContainer(id); | 19 return Shell::GetInstance()->GetContainer(id); |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Returns true if children of |window| can be activated. | 22 // Returns true if children of |window| can be activated. |
| 23 bool SupportsChildActivation(aura::Window* window) { | 23 bool SupportsChildActivation(aura::Window* window) { |
| 24 return window->id() == kShellWindowId_DefaultContainer || | 24 return window->id() == kShellWindowId_DefaultContainer || |
| 25 window->id() == kShellWindowId_AlwaysOnTopContainer || | 25 window->id() == kShellWindowId_AlwaysOnTopContainer || |
| 26 window->id() == kShellWindowId_ModalContainer; | 26 window->id() == kShellWindowId_ModalContainer || |
| 27 window->id() == kShellWindowId_LockModalContainer; | |
| 27 } | 28 } |
| 28 | 29 |
| 29 bool IsWindowModal(aura::Window* window) { | 30 bool IsWindowModal(aura::Window* window) { |
| 30 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); | 31 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); |
| 31 } | 32 } |
| 32 | 33 |
| 33 } // namespace | 34 } // namespace |
| 34 | 35 |
| 35 //////////////////////////////////////////////////////////////////////////////// | 36 //////////////////////////////////////////////////////////////////////////////// |
| 36 // StackingController, public: | 37 // StackingController, public: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 69 |
| 69 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
| 70 // StackingController, aura::StackingClient implementation: | 71 // StackingController, aura::StackingClient implementation: |
| 71 | 72 |
| 72 void StackingController::AddChildToDefaultParent(aura::Window* window) { | 73 void StackingController::AddChildToDefaultParent(aura::Window* window) { |
| 73 aura::Window* parent = NULL; | 74 aura::Window* parent = NULL; |
| 74 switch (window->type()) { | 75 switch (window->type()) { |
| 75 case aura::WINDOW_TYPE_NORMAL: | 76 case aura::WINDOW_TYPE_NORMAL: |
| 76 case aura::WINDOW_TYPE_POPUP: | 77 case aura::WINDOW_TYPE_POPUP: |
| 77 if (IsWindowModal(window)) { | 78 if (IsWindowModal(window)) { |
| 78 parent = GetContainer(internal::kShellWindowId_ModalContainer); | 79 aura::Window* lock_container = |
| 80 GetContainer(internal::kShellWindowId_LockScreenContainer); | |
| 81 // Lock/login screen has its own modal container. | |
| 82 if (!lock_container->children().size()) | |
|
Ben Goodger (Google)
2011/11/28 17:12:56
I realized there is a flaw here that will require
Nikita (slow)
2011/11/29 10:06:34
Done.
| |
| 83 parent = GetContainer(internal::kShellWindowId_ModalContainer); | |
| 84 else | |
| 85 parent = GetContainer(internal::kShellWindowId_LockModalContainer); | |
| 79 break; | 86 break; |
| 80 } | 87 } |
| 81 parent = always_on_top_controller_->GetContainer(window); | 88 parent = always_on_top_controller_->GetContainer(window); |
| 82 break; | 89 break; |
| 83 case aura::WINDOW_TYPE_MENU: | 90 case aura::WINDOW_TYPE_MENU: |
| 84 case aura::WINDOW_TYPE_TOOLTIP: | 91 case aura::WINDOW_TYPE_TOOLTIP: |
| 85 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); | 92 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); |
| 86 break; | 93 break; |
| 87 default: | 94 default: |
| 88 NOTREACHED() << "Window " << window->id() | 95 NOTREACHED() << "Window " << window->id() |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 108 } | 115 } |
| 109 return NULL; | 116 return NULL; |
| 110 } | 117 } |
| 111 | 118 |
| 112 | 119 |
| 113 //////////////////////////////////////////////////////////////////////////////// | 120 //////////////////////////////////////////////////////////////////////////////// |
| 114 // StackingController, private: | 121 // StackingController, private: |
| 115 | 122 |
| 116 } // namespace internal | 123 } // namespace internal |
| 117 } // namespace aura_shell | 124 } // namespace aura_shell |
| OLD | NEW |