summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 19:59:26 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 19:59:26 +0000
commit44fc30fc16c738daaef3bef331ff7a1e5b5b1b05 (patch)
tree62a9ba51ec422e9bd8cafd9de13310835a1a3bae
parentced52850257336648fd357ea294519f5a9f351dd (diff)
downloadchromium_src-44fc30fc16c738daaef3bef331ff7a1e5b5b1b05.zip
chromium_src-44fc30fc16c738daaef3bef331ff7a1e5b5b1b05.tar.gz
chromium_src-44fc30fc16c738daaef3bef331ff7a1e5b5b1b05.tar.bz2
Add support for slowing down all animations on the Mac by using the shift and/or
control key. BUG=27274 TEST= 1) create a window. 2) Create a tab. 3) Hold down the shift key and click in the close button on the tab. 4) Watch animation proceed slowly. (and slower if you hold down shift + control) This should apply to all non-web page animations. Review URL: http://codereview.chromium.org/388004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31588 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--DEPS2
-rw-r--r--chrome/browser/autocomplete/autocomplete_popup_view_mac.mm4
-rw-r--r--chrome/browser/cocoa/animatable_view.mm5
-rw-r--r--chrome/browser/cocoa/download_item_cell.mm5
-rw-r--r--chrome/browser/cocoa/download_shelf_controller.mm20
-rw-r--r--chrome/browser/cocoa/download_started_animation_mac.mm5
-rw-r--r--chrome/browser/cocoa/find_bar_cocoa_controller.mm3
-rw-r--r--chrome/browser/cocoa/preferences_window_controller.mm3
-rw-r--r--chrome/browser/cocoa/status_bubble_mac.mm3
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm5
-rwxr-xr-xchrome/chrome.gyp2
11 files changed, 35 insertions, 22 deletions
diff --git a/DEPS b/DEPS
index c1e36c9..0ec2306 100644
--- a/DEPS
+++ b/DEPS
@@ -122,7 +122,7 @@ deps_os = {
},
"mac": {
"src/third_party/GTM":
- "http://google-toolbox-for-mac.googlecode.com/svn/trunk@243",
+ "http://google-toolbox-for-mac.googlecode.com/svn/trunk@247",
"src/third_party/pdfsqueeze":
"http://pdfsqueeze.googlecode.com/svn/trunk@2",
"src/third_party/WebKit/WebKit/mac":
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index e4cceee..beaa239 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -14,6 +14,7 @@
#include "chrome/browser/bubble_positioner.h"
#include "chrome/browser/cocoa/event_utils.h"
#include "grit/theme_resources.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
namespace {
@@ -431,7 +432,8 @@ void AutocompletePopupViewMac::UpdatePopupAppearance() {
r.origin.x == oldFrame.origin.x &&
r.size.width == oldFrame.size.width) {
[NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:kShrinkAnimationDuration];
+ [[NSAnimationContext currentContext]
+ gtm_setDuration:kShrinkAnimationDuration];
[[popup_ animator] setFrame:r display:YES];
[NSAnimationContext endGrouping];
} else {
diff --git a/chrome/browser/cocoa/animatable_view.mm b/chrome/browser/cocoa/animatable_view.mm
index 7098e37..2f716f8 100644
--- a/chrome/browser/cocoa/animatable_view.mm
+++ b/chrome/browser/cocoa/animatable_view.mm
@@ -6,6 +6,7 @@
#import <QuartzCore/QuartzCore.h>
#import "chrome/browser/cocoa/animatable_view.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
// NSAnimation subclass that animates the height of an AnimatableView. Allows
// the caller to start and cancel the animation as desired.
@@ -27,8 +28,8 @@
- (id)initWithView:(AnimatableView*)view
finalHeight:(CGFloat)height
duration:(NSTimeInterval)duration {
- if ((self = [super initWithDuration:duration
- animationCurve:NSAnimationEaseIn])) {
+ if ((self = [super gtm_initWithDuration:duration
+ animationCurve:NSAnimationEaseIn])) {
view_ = view;
startHeight_ = [view_ height];
endHeight_ = height;
diff --git a/chrome/browser/cocoa/download_item_cell.mm b/chrome/browser/cocoa/download_item_cell.mm
index a108565..8c180c7 100644
--- a/chrome/browser/cocoa/download_item_cell.mm
+++ b/chrome/browser/cocoa/download_item_cell.mm
@@ -13,6 +13,7 @@
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_util.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
#import "third_party/GTM/AppKit/GTMTheme.h"
namespace {
@@ -548,8 +549,8 @@ const int kCompleteAnimationDuration = 2.5;
- (id)initWithDownloadItemCell:(DownloadItemCell*)cell
duration:(NSTimeInterval)duration
animationCurve:(NSAnimationCurve)animationCurve {
- if ((self = [super initWithDuration:duration
- animationCurve:animationCurve])) {
+ if ((self = [super gtm_initWithDuration:duration
+ animationCurve:animationCurve])) {
cell_ = cell;
[self setAnimationBlockingMode:NSAnimationNonblocking];
}
diff --git a/chrome/browser/cocoa/download_shelf_controller.mm b/chrome/browser/cocoa/download_shelf_controller.mm
index 28aa118..e1faf3e 100644
--- a/chrome/browser/cocoa/download_shelf_controller.mm
+++ b/chrome/browser/cocoa/download_shelf_controller.mm
@@ -21,6 +21,7 @@
#include "chrome/browser/profile.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
namespace {
@@ -112,7 +113,7 @@ const NSTimeInterval kDownloadShelfCloseDuration = 0.12;
ThemeProvider* provider = bridge_->browser()->profile()->GetThemeProvider();
if (provider)
useDefaultColor = provider->GetColor(
- BrowserThemeProvider::COLOR_BOOKMARK_TEXT) ==
+ BrowserThemeProvider::COLOR_BOOKMARK_TEXT) ==
BrowserThemeProvider::kDefaultColorBookmarkText;
}
@@ -238,7 +239,7 @@ const NSTimeInterval kDownloadShelfCloseDuration = 0.12;
// Adding at index 0 in NSMutableArrays is O(1).
[downloadItemControllers_ insertObject:controller.get() atIndex:0];
- [itemContainerView_ addSubview:[controller.get() view]];
+ [itemContainerView_ addSubview:[controller view]];
// The controller is in charge of removing itself as an observer in its
// dealloc.
@@ -254,15 +255,16 @@ const NSTimeInterval kDownloadShelfCloseDuration = 0.12;
object:itemContainerView_];
// Start at width 0...
- NSSize size = [controller.get() preferredSize];
+ NSSize size = [controller preferredSize];
NSRect frame = NSMakeRect(0, 0, 0, size.height);
- [[controller.get() view] setFrame:frame];
+ [[controller view] setFrame:frame];
// ...then animate in
frame.size.width = size.width;
[NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:kDownloadItemOpenDuration];
- [[[controller.get() view] animator] setFrame:frame];
+ [[NSAnimationContext currentContext]
+ gtm_setDuration:kDownloadItemOpenDuration];
+ [[[controller view] animator] setFrame:frame];
[NSAnimationContext endGrouping];
// Keep only a limited number of items in the shelf.
@@ -283,9 +285,9 @@ const NSTimeInterval kDownloadShelfCloseDuration = 0.12;
- (void)closed {
NSUInteger i = 0;
- while (i < [downloadItemControllers_.get() count]) {
- DownloadItemController* itemController = [downloadItemControllers_.get()
- objectAtIndex:i];
+ while (i < [downloadItemControllers_ count]) {
+ DownloadItemController* itemController =
+ [downloadItemControllers_ objectAtIndex:i];
bool isTransferDone =
[itemController download]->state() == DownloadItem::COMPLETE ||
[itemController download]->state() == DownloadItem::CANCELLED;
diff --git a/chrome/browser/cocoa/download_started_animation_mac.mm b/chrome/browser/cocoa/download_started_animation_mac.mm
index dde9101..e7cf227 100644
--- a/chrome/browser/cocoa/download_started_animation_mac.mm
+++ b/chrome/browser/cocoa/download_started_animation_mac.mm
@@ -19,6 +19,7 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_service.h"
#include "grit/theme_resources.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
#include "third_party/skia/include/utils/mac/SkCGUtils.h"
class DownloadAnimationTabObserver;
@@ -164,7 +165,7 @@ private:
[CABasicAnimation animationWithKeyPath:@"position"];
[animation setFromValue:[NSValue valueWithPoint:start]];
[animation setToValue:[NSValue valueWithPoint:stop]];
- [animation setDuration:0.6];
+ [animation gtm_setDuration:0.6];
CAMediaTimingFunction* mediaFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[animation setTimingFunction:mediaFunction];
@@ -175,7 +176,7 @@ private:
animation = [CABasicAnimation animationWithKeyPath:@"opacity"];
[animation setFromValue:[NSNumber numberWithFloat:1.0]];
[animation setToValue:[NSNumber numberWithFloat:0.0]];
- [animation setDuration:1.5]; // Slightly longer, so it doesn't fade too much.
+ [animation gtm_setDuration:1.5]; // Longer, so it doesn't fade too much.
mediaFunction =
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
[animation setTimingFunction:mediaFunction];
diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/cocoa/find_bar_cocoa_controller.mm
index 009370b..904de41 100644
--- a/chrome/browser/cocoa/find_bar_cocoa_controller.mm
+++ b/chrome/browser/cocoa/find_bar_cocoa_controller.mm
@@ -16,6 +16,7 @@
#import "chrome/browser/cocoa/focus_tracker.h"
#import "chrome/browser/cocoa/tab_strip_controller.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
namespace {
static float kFindBarOpenDuration = 0.2;
@@ -340,7 +341,7 @@ static float kFindBarCloseDuration = 0.15;
currentAnimation_.reset(
[[NSViewAnimation alloc]
initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]);
- [currentAnimation_ setDuration:duration];
+ [currentAnimation_ gtm_setDuration:duration];
[currentAnimation_ setDelegate:self];
[currentAnimation_ startAnimation];
}
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 373f090..bdb4dd6 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -39,6 +39,7 @@
#include "grit/locale_settings.h"
#include "net/base/cookie_policy.h"
#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
NSString* const kUserDoneEditingPrefsNotification =
@"kUserDoneEditingPrefsNotification";
@@ -431,7 +432,7 @@ class PrefObserverBridge : public NotificationObserver {
[animation_ setDelegate:self];
// The default duration is 0.5s, which actually feels slow in here, so speed
// it up a bit.
- [animation_ setDuration:0.2];
+ [animation_ gtm_setDuration:0.2];
[animation_ setAnimationBlockingMode:NSAnimationNonblocking];
}
return self;
diff --git a/chrome/browser/cocoa/status_bubble_mac.mm b/chrome/browser/cocoa/status_bubble_mac.mm
index 998da13..9e718a3 100644
--- a/chrome/browser/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/cocoa/status_bubble_mac.mm
@@ -13,6 +13,7 @@
#include "base/sys_string_conversions.h"
#import "chrome/browser/cocoa/bubble_view.h"
#include "googleurl/src/gurl.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
#import "third_party/GTM/AppKit/GTMNSBezierPath+RoundRect.h"
#import "third_party/GTM/AppKit/GTMNSColor+Luminance.h"
#import "third_party/GTM/AppKit/GTMTheme.h"
@@ -407,7 +408,7 @@ void StatusBubbleMac::Fade(bool show) {
// This will cancel an in-progress transition and replace it with this fade.
[NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:duration];
+ [[NSAnimationContext currentContext] gtm_setDuration:duration];
[[window_ animator] setAlphaValue:opacity];
[NSAnimationContext endGrouping];
}
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index dcc25ea..72f3324 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -36,6 +36,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "skia/ext/skia_utils_mac.h"
+#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged";
@@ -546,7 +547,7 @@ static const NSTimeInterval kAnimationDuration = 0.2;
NSRect enclosingRect = NSZeroRect;
[NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:kAnimationDuration];
+ [[NSAnimationContext currentContext] gtm_setDuration:kAnimationDuration];
// Update the current subviews and their z-order if requested.
if (doUpdate)
@@ -912,7 +913,7 @@ static const NSTimeInterval kAnimationDuration = 0.2;
NSRect newFrame = [tabView frame];
newFrame = NSOffsetRect(newFrame, 0, -newFrame.size.height);
[NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:kAnimationDuration];
+ [[NSAnimationContext currentContext] gtm_setDuration:kAnimationDuration];
[[tabView animator] setFrame:newFrame];
[NSAnimationContext endGrouping];
}
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 8affdb2..36a420f 100755
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -2626,6 +2626,8 @@
'../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h',
'../third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.m',
'../third_party/GTM/AppKit/GTMWindowSheetController.m',
+ '../third_party/GTM/AppKit/GTMNSAnimation+Duration.m',
+ '../third_party/GTM/AppKit/GTMNSAnimation+Duration.h',
'../third_party/GTM/Foundation/GTMNSNumber+64Bit.h',
'../third_party/GTM/Foundation/GTMNSNumber+64Bit.m',
# Build necessary Mozilla sources