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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/browser_actions_controller.mm

Issue 1862243006: [Mac] Prevent extension icon animation when window not visible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" 5 #import "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 [button removeFromSuperview]; 651 [button removeFromSuperview];
652 [button onRemoved]; 652 [button onRemoved];
653 } 653 }
654 [buttons_ removeAllObjects]; 654 [buttons_ removeAllObjects];
655 } 655 }
656 656
657 - (void)resizeContainerToWidth:(CGFloat)width { 657 - (void)resizeContainerToWidth:(CGFloat)width {
658 // Cocoa goes a little crazy if we try and change animations while adjusting 658 // Cocoa goes a little crazy if we try and change animations while adjusting
659 // child frames (i.e., the buttons). If the toolbar is already animating, 659 // child frames (i.e., the buttons). If the toolbar is already animating,
660 // just jump to the new frame. (This typically only happens if someone is 660 // just jump to the new frame. (This typically only happens if someone is
661 // "spamming" a button to add/remove an action.) 661 // "spamming" a button to add/remove an action.) If the window isn't visible
662 // (for example it's in the process of being created), don't bother animating.
662 BOOL animate = !toolbarActionsBar_->suppress_animation() && 663 BOOL animate = !toolbarActionsBar_->suppress_animation() &&
663 ![containerView_ isAnimating]; 664 ![containerView_ isAnimating] && [[containerView_ window] isVisible];
664 [self updateContainerVisibility]; 665 [self updateContainerVisibility];
665 [containerView_ resizeToWidth:width 666 [containerView_ resizeToWidth:width
666 animate:animate]; 667 animate:animate];
667 NSRect frame = animate ? [containerView_ animationEndFrame] : 668 NSRect frame = animate ? [containerView_ animationEndFrame] :
668 [containerView_ frame]; 669 [containerView_ frame];
669 670
670 [self showChevronIfNecessaryInFrame:frame]; 671 [self showChevronIfNecessaryInFrame:frame];
671 672
672 [containerView_ setNeedsDisplay:YES]; 673 [containerView_ setNeedsDisplay:YES];
673 674
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 } 1073 }
1073 1074
1074 #pragma mark - 1075 #pragma mark -
1075 #pragma mark Testing Methods 1076 #pragma mark Testing Methods
1076 1077
1077 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { 1078 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index {
1078 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; 1079 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil;
1079 } 1080 }
1080 1081
1081 @end 1082 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698