| 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 "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "ui/aura/client/activation_client.h" | 13 #include "ui/aura/client/activation_client.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/aura/env_observer.h" | 15 #include "ui/aura/env_observer.h" |
| 16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_observer.h" | 18 #include "ui/aura/window_observer.h" |
| 19 #include "ui/compositor/layer.h" | 19 #include "ui/compositor/layer.h" |
| 20 #include "ui/views/corewm/shadow.h" | 20 #include "ui/views/corewm/shadow.h" |
| 21 #include "ui/views/corewm/shadow_types.h" | 21 #include "ui/views/corewm/shadow_types.h" |
| 22 #include "ui/views/corewm/window_util.h" |
| 22 | 23 |
| 23 using std::make_pair; | 24 using std::make_pair; |
| 24 | 25 |
| 25 namespace views { | 26 namespace views { |
| 26 namespace corewm { | 27 namespace corewm { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 ShadowType GetShadowTypeFromWindow(aura::Window* window) { | 31 ShadowType GetShadowTypeFromWindow(aura::Window* window) { |
| 31 switch (window->type()) { | 32 switch (window->type()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Returns the shadow style to be applied to |losing_active| when it is losing | 55 // Returns the shadow style to be applied to |losing_active| when it is losing |
| 55 // active to |gaining_active|. |gaining_active| may be of a type that hides when | 56 // active to |gaining_active|. |gaining_active| may be of a type that hides when |
| 56 // inactive, and as such we do not want to render |losing_active| as inactive. | 57 // inactive, and as such we do not want to render |losing_active| as inactive. |
| 57 Shadow::Style GetShadowStyleForWindowLosingActive( | 58 Shadow::Style GetShadowStyleForWindowLosingActive( |
| 58 aura::Window* losing_active, | 59 aura::Window* losing_active, |
| 59 aura::Window* gaining_active) { | 60 aura::Window* gaining_active) { |
| 60 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) { | 61 if (gaining_active && aura::client::GetHideOnDeactivate(gaining_active)) { |
| 61 aura::Window::Windows::const_iterator it = | 62 aura::Window::Windows::const_iterator it = |
| 62 std::find(losing_active->transient_children().begin(), | 63 std::find(GetTransientChildren(losing_active).begin(), |
| 63 losing_active->transient_children().end(), | 64 GetTransientChildren(losing_active).end(), |
| 64 gaining_active); | 65 gaining_active); |
| 65 if (it != losing_active->transient_children().end()) | 66 if (it != GetTransientChildren(losing_active).end()) |
| 66 return Shadow::STYLE_ACTIVE; | 67 return Shadow::STYLE_ACTIVE; |
| 67 } | 68 } |
| 68 return Shadow::STYLE_INACTIVE; | 69 return Shadow::STYLE_INACTIVE; |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace | 72 } // namespace |
| 72 | 73 |
| 73 // ShadowController::Impl ------------------------------------------------------ | 74 // ShadowController::Impl ------------------------------------------------------ |
| 74 | 75 |
| 75 // Real implementation of the ShadowController. ShadowController observes | 76 // Real implementation of the ShadowController. ShadowController observes |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 265 } |
| 265 | 266 |
| 266 // ShadowController::TestApi --------------------------------------------------- | 267 // ShadowController::TestApi --------------------------------------------------- |
| 267 | 268 |
| 268 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { | 269 Shadow* ShadowController::TestApi::GetShadowForWindow(aura::Window* window) { |
| 269 return controller_->impl_->GetShadowForWindow(window); | 270 return controller_->impl_->GetShadowForWindow(window); |
| 270 } | 271 } |
| 271 | 272 |
| 272 } // namespace corewm | 273 } // namespace corewm |
| 273 } // namespace views | 274 } // namespace views |
| OLD | NEW |