| 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/root_window.h" | 8 #include "ui/aura/root_window.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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 bool IsWindowModal(aura::Window* window) { | 22 bool IsWindowModal(aura::Window* window) { |
| 23 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); | 23 return window->transient_parent() && window->GetIntProperty(aura::kModalKey); |
| 24 } | 24 } |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 //////////////////////////////////////////////////////////////////////////////// | 28 //////////////////////////////////////////////////////////////////////////////// |
| 29 // StackingController, public: | 29 // StackingController, public: |
| 30 | 30 |
| 31 StackingController::StackingController() { | 31 StackingController::StackingController() { |
| 32 aura::RootWindow::GetInstance()->SetStackingClient(this); | 32 aura::client::SetStackingClient(this); |
| 33 } | |
| 34 | |
| 35 StackingController::~StackingController() { | |
| 36 } | |
| 37 | |
| 38 void StackingController::Init() { | |
| 39 always_on_top_controller_.reset(new internal::AlwaysOnTopController); | 33 always_on_top_controller_.reset(new internal::AlwaysOnTopController); |
| 40 always_on_top_controller_->SetContainers( | 34 always_on_top_controller_->SetContainers( |
| 41 GetContainer(internal::kShellWindowId_DefaultContainer), | 35 GetContainer(internal::kShellWindowId_DefaultContainer), |
| 42 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); | 36 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer)); |
| 43 } | 37 } |
| 44 | 38 |
| 39 StackingController::~StackingController() { |
| 40 } |
| 41 |
| 45 //////////////////////////////////////////////////////////////////////////////// | 42 //////////////////////////////////////////////////////////////////////////////// |
| 46 // StackingController, aura::StackingClient implementation: | 43 // StackingController, aura::StackingClient implementation: |
| 47 | 44 |
| 48 void StackingController::AddChildToDefaultParent(aura::Window* window) { | 45 aura::Window* StackingController::GetDefaultParent(aura::Window* window) { |
| 49 aura::Window* parent = NULL; | |
| 50 switch (window->type()) { | 46 switch (window->type()) { |
| 51 case aura::WINDOW_TYPE_NORMAL: | 47 case aura::WINDOW_TYPE_NORMAL: |
| 52 case aura::WINDOW_TYPE_POPUP: | 48 case aura::WINDOW_TYPE_POPUP: |
| 53 if (IsWindowModal(window)) { | 49 if (IsWindowModal(window)) |
| 54 parent = GetModalContainer(window); | 50 return GetModalContainer(window); |
| 55 break; | 51 return always_on_top_controller_->GetContainer(window); |
| 56 } | |
| 57 parent = always_on_top_controller_->GetContainer(window); | |
| 58 break; | |
| 59 case aura::WINDOW_TYPE_MENU: | 52 case aura::WINDOW_TYPE_MENU: |
| 60 case aura::WINDOW_TYPE_TOOLTIP: | 53 case aura::WINDOW_TYPE_TOOLTIP: |
| 61 parent = GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); | 54 return GetContainer(internal::kShellWindowId_MenusAndTooltipsContainer); |
| 62 break; | |
| 63 default: | 55 default: |
| 64 NOTREACHED() << "Window " << window->id() | 56 NOTREACHED() << "Window " << window->id() |
| 65 << " has unhandled type " << window->type(); | 57 << " has unhandled type " << window->type(); |
| 66 break; | 58 break; |
| 67 } | 59 } |
| 68 parent->AddChild(window); | 60 return NULL; |
| 69 } | 61 } |
| 70 | 62 |
| 71 //////////////////////////////////////////////////////////////////////////////// | 63 //////////////////////////////////////////////////////////////////////////////// |
| 72 // StackingController, private: | 64 // StackingController, private: |
| 73 | 65 |
| 74 aura::Window* StackingController::GetModalContainer( | 66 aura::Window* StackingController::GetModalContainer( |
| 75 aura::Window* window) const { | 67 aura::Window* window) const { |
| 76 if (!IsWindowModal(window)) | 68 if (!IsWindowModal(window)) |
| 77 return NULL; | 69 return NULL; |
| 78 | 70 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 92 if (window_container_id < lock_container_id) | 84 if (window_container_id < lock_container_id) |
| 93 container = GetContainer(internal::kShellWindowId_ModalContainer); | 85 container = GetContainer(internal::kShellWindowId_ModalContainer); |
| 94 else | 86 else |
| 95 container = GetContainer(internal::kShellWindowId_LockModalContainer); | 87 container = GetContainer(internal::kShellWindowId_LockModalContainer); |
| 96 | 88 |
| 97 return container; | 89 return container; |
| 98 } | 90 } |
| 99 | 91 |
| 100 } // namespace internal | 92 } // namespace internal |
| 101 } // namespace aura_shell | 93 } // namespace aura_shell |
| OLD | NEW |