| 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/shadow_controller.h" | 5 #include "ash/wm/shadow_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/shadow.h" | 10 #include "ash/wm/shadow.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 return Shadow::STYLE_INACTIVE; | 66 return Shadow::STYLE_INACTIVE; |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace | 69 } // namespace |
| 70 | 70 |
| 71 ShadowController::ShadowController() | 71 ShadowController::ShadowController() |
| 72 : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)) { | 72 : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)) { |
| 73 aura::Env::GetInstance()->AddObserver(this); | 73 aura::Env::GetInstance()->AddObserver(this); |
| 74 // Watch for window activation changes. | 74 // Watch for window activation changes. |
| 75 Shell::GetRootWindow()->AddObserver(this); | 75 Shell::GetPrimaryRootWindow()->AddObserver(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 ShadowController::~ShadowController() { | 78 ShadowController::~ShadowController() { |
| 79 Shell::GetRootWindow()->RemoveObserver(this); | 79 Shell::GetPrimaryRootWindow()->RemoveObserver(this); |
| 80 aura::Env::GetInstance()->RemoveObserver(this); | 80 aura::Env::GetInstance()->RemoveObserver(this); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void ShadowController::OnWindowInitialized(aura::Window* window) { | 83 void ShadowController::OnWindowInitialized(aura::Window* window) { |
| 84 observer_manager_.Add(window); | 84 observer_manager_.Add(window); |
| 85 SetShadowType(window, GetShadowTypeFromWindow(window)); | 85 SetShadowType(window, GetShadowTypeFromWindow(window)); |
| 86 HandlePossibleShadowVisibilityChange(window); | 86 HandlePossibleShadowVisibilityChange(window); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void ShadowController::OnWindowPropertyChanged(aura::Window* window, | 89 void ShadowController::OnWindowPropertyChanged(aura::Window* window, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 165 |
| 166 shadow->Init(ShouldUseSmallShadowForWindow(window) ? | 166 shadow->Init(ShouldUseSmallShadowForWindow(window) ? |
| 167 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); | 167 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); |
| 168 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); | 168 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); |
| 169 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); | 169 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); |
| 170 window->layer()->Add(shadow->layer()); | 170 window->layer()->Add(shadow->layer()); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace internal | 173 } // namespace internal |
| 174 } // namespace ash | 174 } // namespace ash |
| OLD | NEW |