Chromium Code Reviews| 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 "ui/views/corewm/shadow_controller.h" | 5 #include "ui/views/corewm/shadow_controller.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "ui/aura/client/activation_client.h" | 11 #include "ui/aura/client/activation_client.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
| 16 #include "ui/views/corewm/focus_change_event.h" | |
|
sadrul
2012/12/03 06:32:17
This doesn't seem necessary
| |
| 16 #include "ui/views/corewm/shadow.h" | 17 #include "ui/views/corewm/shadow.h" |
| 17 #include "ui/views/corewm/shadow_types.h" | 18 #include "ui/views/corewm/shadow_types.h" |
| 18 | 19 |
| 19 using std::make_pair; | 20 using std::make_pair; |
| 20 | 21 |
| 21 namespace views { | 22 namespace views { |
| 22 namespace corewm { | 23 namespace corewm { |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 gaining_active); | 61 gaining_active); |
| 61 if (it != losing_active->transient_children().end()) | 62 if (it != losing_active->transient_children().end()) |
| 62 return Shadow::STYLE_ACTIVE; | 63 return Shadow::STYLE_ACTIVE; |
| 63 } | 64 } |
| 64 return Shadow::STYLE_INACTIVE; | 65 return Shadow::STYLE_INACTIVE; |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace | 68 } // namespace |
| 68 | 69 |
| 69 ShadowController::ShadowController(aura::RootWindow* root_window) | 70 ShadowController::ShadowController(aura::RootWindow* root_window) |
| 70 : ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)), | 71 : ActivationChangeShim(root_window), |
| 72 ALLOW_THIS_IN_INITIALIZER_LIST(observer_manager_(this)), | |
| 71 root_window_(root_window) { | 73 root_window_(root_window) { |
| 72 aura::Env::GetInstance()->AddObserver(this); | 74 aura::Env::GetInstance()->AddObserver(this); |
| 73 // Watch for window activation changes. | 75 // Watch for window activation changes. |
| 74 aura::client::GetActivationClient(root_window_)->AddObserver(this); | 76 aura::client::GetActivationClient(root_window_)->AddObserver(this); |
| 75 } | 77 } |
| 76 | 78 |
| 77 ShadowController::~ShadowController() { | 79 ShadowController::~ShadowController() { |
| 78 aura::client::GetActivationClient(root_window_)->RemoveObserver(this); | 80 aura::client::GetActivationClient(root_window_)->RemoveObserver(this); |
| 79 aura::Env::GetInstance()->RemoveObserver(this); | 81 aura::Env::GetInstance()->RemoveObserver(this); |
| 80 } | 82 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 159 |
| 158 shadow->Init(ShouldUseSmallShadowForWindow(window) ? | 160 shadow->Init(ShouldUseSmallShadowForWindow(window) ? |
| 159 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); | 161 Shadow::STYLE_SMALL : Shadow::STYLE_ACTIVE); |
| 160 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); | 162 shadow->SetContentBounds(gfx::Rect(window->bounds().size())); |
| 161 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); | 163 shadow->layer()->SetVisible(ShouldShowShadowForWindow(window)); |
| 162 window->layer()->Add(shadow->layer()); | 164 window->layer()->Add(shadow->layer()); |
| 163 } | 165 } |
| 164 | 166 |
| 165 } // namespace corewm | 167 } // namespace corewm |
| 166 } // namespace views | 168 } // namespace views |
| OLD | NEW |