| 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 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_animation
.h" | 5 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_animation
.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
| 10 #include "base/native_library.h" | 10 #include "base/native_library.h" |
| 11 #include "ui/base/animation/tween.h" | 11 #include "ui/gfx/animation/tween.h" |
| 12 | 12 |
| 13 // The window animations in this file use private APIs as described here: | 13 // The window animations in this file use private APIs as described here: |
| 14 // http://code.google.com/p/undocumented-goodness/source/browse/trunk/CoreGraphi
cs/CGSPrivate.h | 14 // http://code.google.com/p/undocumented-goodness/source/browse/trunk/CoreGraphi
cs/CGSPrivate.h |
| 15 // There are two important things to keep in mind when modifying this file: | 15 // There are two important things to keep in mind when modifying this file: |
| 16 // - For most operations the origin of the coordinate system is top left. | 16 // - For most operations the origin of the coordinate system is top left. |
| 17 // - Perspective and shear transformations get clipped if they are bigger | 17 // - Perspective and shear transformations get clipped if they are bigger |
| 18 // than the window size. This does not seem to apply to scale transformations. | 18 // than the window size. This does not seem to apply to scale transformations. |
| 19 | 19 |
| 20 // Length of the animation in seconds. | 20 // Length of the animation in seconds. |
| 21 const NSTimeInterval kAnimationDuration = 0.18; | 21 const NSTimeInterval kAnimationDuration = 0.18; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 {0.40, 1.02}, | 281 {0.40, 1.02}, |
| 282 {0.60, 1.02}, | 282 {0.60, 1.02}, |
| 283 {1.00, 1.0}, | 283 {1.00, 1.0}, |
| 284 }; | 284 }; |
| 285 | 285 |
| 286 CGFloat scale = 1; | 286 CGFloat scale = 1; |
| 287 for (int i = arraysize(frames) - 1; i >= 0; --i) { | 287 for (int i = arraysize(frames) - 1; i >= 0; --i) { |
| 288 if (value >= frames[i].value) { | 288 if (value >= frames[i].value) { |
| 289 CGFloat delta = frames[i + 1].value - frames[i].value; | 289 CGFloat delta = frames[i + 1].value - frames[i].value; |
| 290 CGFloat frame_progress = (value - frames[i].value) / delta; | 290 CGFloat frame_progress = (value - frames[i].value) / delta; |
| 291 scale = ui::Tween::ValueBetween(frame_progress, | 291 scale = gfx::Tween::ValueBetween(frame_progress, |
| 292 frames[i].scale, | 292 frames[i].scale, |
| 293 frames[i + 1].scale); | 293 frames[i + 1].scale); |
| 294 break; | 294 break; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 SetWindowScale(window_, scale); | 298 SetWindowScale(window_, scale); |
| 299 } | 299 } |
| 300 | 300 |
| 301 - (void)setWindowStateForEnd { | 301 - (void)setWindowStateForEnd { |
| 302 SetWindowScale(window_, 1.0); | 302 SetWindowScale(window_, 1.0); |
| 303 } | 303 } |
| 304 | 304 |
| 305 @end | 305 @end |
| OLD | NEW |