Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: ash/wm/window_animations.cc

Issue 180273025: Keep dedicated layers for hiding animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/wm/window_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 void AnimateHideWindow_Minimize(aura::Window* window) { 171 void AnimateHideWindow_Minimize(aura::Window* window) {
172 window->layer()->set_delegate(NULL); 172 window->layer()->set_delegate(NULL);
173 173
174 // Property sets within this scope will be implicitly animated. 174 // Property sets within this scope will be implicitly animated.
175 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); 175 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
176 base::TimeDelta duration = base::TimeDelta::FromMilliseconds( 176 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
177 kLayerAnimationsForMinimizeDurationMS); 177 kLayerAnimationsForMinimizeDurationMS);
178 settings.SetTransitionDuration(duration); 178 settings.SetTransitionDuration(duration);
179 settings.AddObserver( 179 scoped_ptr<views::corewm::LayerDetacherForHidingAnimation> detacher =
180 views::corewm::CreateHidingWindowAnimationObserver(window)); 180 views::corewm::DetachAndRecreateLayersForHidingAnimation(
181 window, &settings).Pass();
181 window->layer()->SetVisible(false); 182 window->layer()->SetVisible(false);
182 183
183 AddLayerAnimationsForMinimize(window, false); 184 AddLayerAnimationsForMinimize(window, false);
184 } 185 }
185 186
186 void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window, 187 void AnimateShowHideWindowCommon_BrightnessGrayscale(aura::Window* window,
187 bool show) { 188 bool show) {
188 window->layer()->set_delegate(window); 189 window->layer()->set_delegate(window);
189 190
190 float start_value, end_value; 191 float start_value, end_value;
(...skipping 11 matching lines...) Expand all
202 window->layer()->SetOpacity(kWindowAnimation_ShowOpacity); 203 window->layer()->SetOpacity(kWindowAnimation_ShowOpacity);
203 window->layer()->SetVisible(true); 204 window->layer()->SetVisible(true);
204 } 205 }
205 206
206 base::TimeDelta duration = 207 base::TimeDelta duration =
207 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs); 208 base::TimeDelta::FromMilliseconds(kBrightnessGrayscaleFadeDurationMs);
208 209
209 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator()); 210 ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
210 settings.SetTransitionDuration(duration); 211 settings.SetTransitionDuration(duration);
211 if (!show) { 212 if (!show) {
212 settings.AddObserver( 213 views::corewm::DetachLayersForHidingAnimationWhenDestroyed(
213 views::corewm::CreateHidingWindowAnimationObserver(window)); 214 window, &settings);
214 } 215 }
215 216
216 window->layer()->GetAnimator()-> 217 window->layer()->GetAnimator()->
217 ScheduleTogether( 218 ScheduleTogether(
218 CreateBrightnessGrayscaleAnimationSequence(end_value, duration)); 219 CreateBrightnessGrayscaleAnimationSequence(end_value, duration));
219 if (!show) { 220 if (!show) {
220 window->layer()->SetOpacity(kWindowAnimation_HideOpacity); 221 window->layer()->SetOpacity(kWindowAnimation_HideOpacity);
221 window->layer()->SetVisible(false); 222 window->layer()->SetVisible(false);
222 } 223 }
223 } 224 }
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 496 }
496 497
497 // Assume the shelf is overflowed, zoom off to the bottom right of the 498 // Assume the shelf is overflowed, zoom off to the bottom right of the
498 // work area. 499 // work area.
499 gfx::Rect work_area = 500 gfx::Rect work_area =
500 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); 501 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
501 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); 502 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
502 } 503 }
503 504
504 } // namespace ash 505 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698