| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/maximize_mode/workspace_backdrop_delegate.h" | 5 #include "ash/wm/maximize_mode/workspace_backdrop_delegate.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_animations.h" | 7 #include "ash/wm/window_animations.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
| 12 #include "ui/compositor/scoped_layer_animation_settings.h" | 12 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 13 #include "ui/views/background.h" | 13 #include "ui/views/background.h" |
| 14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 15 #include "ui/wm/core/window_animations.h" |
| 15 #include "ui/wm/core/window_util.h" | 16 #include "ui/wm/core/window_util.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 namespace internal { | 20 namespace internal { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // The opacity of the backdrop. | 24 // The opacity of the backdrop. |
| 24 const float kBackdropOpacity = 0.5f; | 25 const float kBackdropOpacity = 0.5f; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 background_->Init(params); | 42 background_->Init(params); |
| 42 background_->GetNativeView()->SetName("WorkspaceBackdropDelegate"); | 43 background_->GetNativeView()->SetName("WorkspaceBackdropDelegate"); |
| 43 background_->GetNativeView()->layer()->SetColor(SK_ColorBLACK); | 44 background_->GetNativeView()->layer()->SetColor(SK_ColorBLACK); |
| 44 Show(); | 45 Show(); |
| 45 RestackBackdrop(); | 46 RestackBackdrop(); |
| 46 container_->AddObserver(this); | 47 container_->AddObserver(this); |
| 47 } | 48 } |
| 48 | 49 |
| 49 WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() { | 50 WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() { |
| 50 container_->RemoveObserver(this); | 51 container_->RemoveObserver(this); |
| 51 ui::ScopedLayerAnimationSettings settings( | 52 ::wm::ScopedHidingAnimationSettings hiding_settings( |
| 52 background_->GetNativeView()->layer()->GetAnimator()); | 53 background_->GetNativeView()); |
| 53 background_->Close(); | 54 background_->Close(); |
| 54 settings.AddObserver(::wm::CreateHidingWindowAnimationObserver( | |
| 55 background_->GetNativeView())); | |
| 56 background_->GetNativeView()->layer()->SetOpacity(0.0f); | 55 background_->GetNativeView()->layer()->SetOpacity(0.0f); |
| 57 } | 56 } |
| 58 | 57 |
| 59 void WorkspaceBackdropDelegate::OnWindowBoundsChanged( | 58 void WorkspaceBackdropDelegate::OnWindowBoundsChanged( |
| 60 aura::Window* window, | 59 aura::Window* window, |
| 61 const gfx::Rect& old_bounds, | 60 const gfx::Rect& old_bounds, |
| 62 const gfx::Rect& new_bounds) { | 61 const gfx::Rect& new_bounds) { |
| 63 // The container size has changed and the layer needs to be adapt to it. | 62 // The container size has changed and the layer needs to be adapt to it. |
| 64 AdjustToContainerBounds(); | 63 AdjustToContainerBounds(); |
| 65 } | 64 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 void WorkspaceBackdropDelegate::Show() { | 144 void WorkspaceBackdropDelegate::Show() { |
| 146 background_->GetNativeView()->layer()->SetOpacity(0.0f); | 145 background_->GetNativeView()->layer()->SetOpacity(0.0f); |
| 147 background_->Show(); | 146 background_->Show(); |
| 148 ui::ScopedLayerAnimationSettings settings( | 147 ui::ScopedLayerAnimationSettings settings( |
| 149 background_->GetNativeView()->layer()->GetAnimator()); | 148 background_->GetNativeView()->layer()->GetAnimator()); |
| 150 background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity); | 149 background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity); |
| 151 } | 150 } |
| 152 | 151 |
| 153 } // namespace internal | 152 } // namespace internal |
| 154 } // namespace ash | 153 } // namespace ash |
| OLD | NEW |