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/shadow_controller.h" | 5 #include "ui/aura_shell/shadow_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
11 #include "ui/aura/client/shadow_types.h" | 11 #include "ui/aura/client/shadow_types.h" |
12 #include "ui/aura/root_window.h" | 12 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura_shell/shadow.h" | 14 #include "ui/aura_shell/shadow.h" |
15 | 15 |
16 using std::make_pair; | 16 using std::make_pair; |
17 | 17 |
18 namespace aura_shell { | 18 namespace aura_shell { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 ShadowController::ShadowController() { | 21 ShadowController::ShadowController() { |
22 aura::RootWindow::GetInstance()->AddRootWindowObserver(this); | 22 aura::RootWindow::GetInstance()->AddObserver(this); |
23 } | 23 } |
24 | 24 |
25 ShadowController::~ShadowController() { | 25 ShadowController::~ShadowController() { |
26 for (WindowShadowMap::const_iterator it = window_shadows_.begin(); | 26 for (WindowShadowMap::const_iterator it = window_shadows_.begin(); |
27 it != window_shadows_.end(); ++it) { | 27 it != window_shadows_.end(); ++it) { |
28 it->first->RemoveObserver(this); | 28 it->first->RemoveObserver(this); |
29 } | 29 } |
30 aura::RootWindow::GetInstance()->RemoveRootWindowObserver(this); | 30 aura::RootWindow::GetInstance()->RemoveObserver(this); |
31 } | 31 } |
32 | 32 |
33 void ShadowController::OnWindowInitialized(aura::Window* window) { | 33 void ShadowController::OnWindowInitialized(aura::Window* window) { |
34 window->AddObserver(this); | 34 window->AddObserver(this); |
35 HandlePossibleShadowVisibilityChange(window); | 35 HandlePossibleShadowVisibilityChange(window); |
36 } | 36 } |
37 | 37 |
38 void ShadowController::OnWindowPropertyChanged(aura::Window* window, | 38 void ShadowController::OnWindowPropertyChanged(aura::Window* window, |
39 const char* name, | 39 const char* name, |
40 void* old) { | 40 void* old) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 window_shadows_.insert(make_pair(window, shadow)); | 87 window_shadows_.insert(make_pair(window, shadow)); |
88 | 88 |
89 shadow->Init(); | 89 shadow->Init(); |
90 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); | 90 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); |
91 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); | 91 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); |
92 window->layer()->Add(shadow->layer()); | 92 window->layer()->Add(shadow->layer()); |
93 } | 93 } |
94 | 94 |
95 } // namespace internal | 95 } // namespace internal |
96 } // namespace aura_shell | 96 } // namespace aura_shell |
OLD | NEW |