| 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/always_on_top_controller.h" | 5 #include "ui/aura_shell/always_on_top_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/aura/window_types.h" | 9 #include "ui/aura/window_types.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 default_container_ = default_container; | 35 default_container_ = default_container; |
| 36 default_container_->AddObserver(this); | 36 default_container_->AddObserver(this); |
| 37 | 37 |
| 38 always_on_top_container_ = always_on_top_container; | 38 always_on_top_container_ = always_on_top_container; |
| 39 always_on_top_container_->AddObserver(this); | 39 always_on_top_container_->AddObserver(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 aura::Window* AlwaysOnTopController::GetContainer(aura::Window* window) const { | 42 aura::Window* AlwaysOnTopController::GetContainer(aura::Window* window) const { |
| 43 DCHECK(default_container_ && always_on_top_container_); | 43 DCHECK(default_container_ && always_on_top_container_); |
| 44 return !window->GetProperty(aura::kAlwaysOnTopKey) ? default_container_ : | 44 return !window->GetBoolProperty(aura::kAlwaysOnTopKey) ? |
| 45 always_on_top_container_; | 45 default_container_ : always_on_top_container_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void AlwaysOnTopController::OnWindowAdded(aura::Window* child) { | 48 void AlwaysOnTopController::OnWindowAdded(aura::Window* child) { |
| 49 // Observe direct child of the containers. | 49 // Observe direct child of the containers. |
| 50 if (child->parent() == default_container_ || | 50 if (child->parent() == default_container_ || |
| 51 child->parent() == always_on_top_container_) { | 51 child->parent() == always_on_top_container_) { |
| 52 child->AddObserver(this); | 52 child->AddObserver(this); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 71 | 71 |
| 72 void AlwaysOnTopController::OnWindowDestroyed(aura::Window* window) { | 72 void AlwaysOnTopController::OnWindowDestroyed(aura::Window* window) { |
| 73 if (window == default_container_) | 73 if (window == default_container_) |
| 74 default_container_ = NULL; | 74 default_container_ = NULL; |
| 75 if (window == always_on_top_container_) | 75 if (window == always_on_top_container_) |
| 76 always_on_top_container_ = NULL; | 76 always_on_top_container_ = NULL; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace internal | 79 } // namespace internal |
| 80 } // namespace aura_shell | 80 } // namespace aura_shell |
| OLD | NEW |