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/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 7 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
8 #include "ash/wm/window_animations.h" | 8 #include "ash/wm/window_animations.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 56 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
57 params.parent = container_; | 57 params.parent = container_; |
58 params.bounds = container_->GetBoundsInScreen(); | 58 params.bounds = container_->GetBoundsInScreen(); |
59 params.layer_type = ui::LAYER_SOLID_COLOR; | 59 params.layer_type = ui::LAYER_SOLID_COLOR; |
60 // To disallow the MRU list from picking this window up it should not be | 60 // To disallow the MRU list from picking this window up it should not be |
61 // activateable. | 61 // activateable. |
62 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 62 params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
63 background_->Init(params); | 63 background_->Init(params); |
64 // Do not use the animation system. We don't want the bounds animation and | 64 // Do not use the animation system. We don't want the bounds animation and |
65 // opacity needs to get set to |kBackdropOpacity|. | 65 // opacity needs to get set to |kBackdropOpacity|. |
66 ::wm::SetWindowVisibilityAnimationTransition( | 66 ::wm::SetWindowVisibilityAnimationTransition(background_->GetNativeView(), |
67 background_->GetNativeView(), | 67 ::wm::ANIMATE_NONE); |
68 ::wm::ANIMATE_NONE); | |
69 background_->GetNativeView()->SetName("WorkspaceBackdropDelegate"); | 68 background_->GetNativeView()->SetName("WorkspaceBackdropDelegate"); |
70 background_->GetNativeView()->layer()->SetColor(SK_ColorBLACK); | 69 background_->GetNativeView()->layer()->SetColor(SK_ColorBLACK); |
71 // Make sure that the layer covers visibly everything - including the shelf. | 70 // Make sure that the layer covers visibly everything - including the shelf. |
72 background_->GetNativeView()->layer()->SetBounds(params.bounds); | 71 background_->GetNativeView()->layer()->SetBounds(params.bounds); |
73 Show(); | 72 Show(); |
74 RestackBackdrop(); | 73 RestackBackdrop(); |
75 container_->AddObserver(container_observer_.get()); | 74 container_->AddObserver(container_observer_.get()); |
76 } | 75 } |
77 | 76 |
78 WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() { | 77 WorkspaceBackdropDelegate::~WorkspaceBackdropDelegate() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Avoid recursive calls. | 113 // Avoid recursive calls. |
115 if (in_restacking_) | 114 if (in_restacking_) |
116 return; | 115 return; |
117 | 116 |
118 aura::Window* window = GetCurrentTopWindow(); | 117 aura::Window* window = GetCurrentTopWindow(); |
119 if (!window) { | 118 if (!window) { |
120 // Hide backdrop since no suitable window was found. | 119 // Hide backdrop since no suitable window was found. |
121 background_->Hide(); | 120 background_->Hide(); |
122 return; | 121 return; |
123 } | 122 } |
124 if (window == background_->GetNativeWindow() && | 123 if (window == background_->GetNativeWindow() && background_->IsVisible()) { |
125 background_->IsVisible()) { | |
126 return; | 124 return; |
127 } | 125 } |
128 if (window->GetRootWindow() != | 126 if (window->GetRootWindow() != |
129 background_->GetNativeWindow()->GetRootWindow()) { | 127 background_->GetNativeWindow()->GetRootWindow()) { |
130 return; | 128 return; |
131 } | 129 } |
132 // We are changing the order of windows which will cause recursion. | 130 // We are changing the order of windows which will cause recursion. |
133 base::AutoReset<bool> lock(&in_restacking_, true); | 131 base::AutoReset<bool> lock(&in_restacking_, true); |
134 if (!background_->IsVisible()) | 132 if (!background_->IsVisible()) |
135 Show(); | 133 Show(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 168 |
171 void WorkspaceBackdropDelegate::Show() { | 169 void WorkspaceBackdropDelegate::Show() { |
172 background_->GetNativeView()->layer()->SetOpacity(0.0f); | 170 background_->GetNativeView()->layer()->SetOpacity(0.0f); |
173 background_->Show(); | 171 background_->Show(); |
174 ui::ScopedLayerAnimationSettings settings( | 172 ui::ScopedLayerAnimationSettings settings( |
175 background_->GetNativeView()->layer()->GetAnimator()); | 173 background_->GetNativeView()->layer()->GetAnimator()); |
176 background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity); | 174 background_->GetNativeView()->layer()->SetOpacity(kBackdropOpacity); |
177 } | 175 } |
178 | 176 |
179 } // namespace ash | 177 } // namespace ash |
OLD | NEW |