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

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

Issue 1346443002: [Extensions UI Mac] Use frameAfterAnimation for extension action button opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 <string> 7 #include <string>
8 8
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/browser/extensions/extension_message_bubble_controller.h" 10 #include "chrome/browser/extensions/extension_message_bubble_controller.h"
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 661
662 - (BOOL)updateContainerVisibility { 662 - (BOOL)updateContainerVisibility {
663 BOOL hidden = [buttons_ count] == 0; 663 BOOL hidden = [buttons_ count] == 0;
664 if ([containerView_ isHidden] != hidden) 664 if ([containerView_ isHidden] != hidden)
665 [containerView_ setHidden:hidden]; 665 [containerView_ setHidden:hidden];
666 return !hidden; 666 return !hidden;
667 } 667 }
668 668
669 - (void)updateButtonOpacity { 669 - (void)updateButtonOpacity {
670 for (BrowserActionButton* button in buttons_.get()) { 670 for (BrowserActionButton* button in buttons_.get()) {
671 NSRect buttonFrame = [button frame]; 671 NSRect buttonFrame = [button frameAfterAnimation];
672 if (NSContainsRect([containerView_ bounds], buttonFrame)) { 672 if (NSContainsRect([containerView_ bounds], buttonFrame)) {
673 if ([button alphaValue] != 1.0) 673 if ([button alphaValue] != 1.0)
674 [button setAlphaValue:1.0]; 674 [button setAlphaValue:1.0];
675 675
676 continue; 676 continue;
677 } 677 }
678 CGFloat intersectionWidth = 678 CGFloat intersectionWidth =
679 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); 679 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame));
680 CGFloat alpha = std::max(static_cast<CGFloat>(0.0), 680 CGFloat alpha = std::max(static_cast<CGFloat>(0.0),
681 intersectionWidth / NSWidth(buttonFrame)); 681 intersectionWidth / NSWidth(buttonFrame));
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1035 }
1036 1036
1037 #pragma mark - 1037 #pragma mark -
1038 #pragma mark Testing Methods 1038 #pragma mark Testing Methods
1039 1039
1040 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index { 1040 - (BrowserActionButton*)buttonWithIndex:(NSUInteger)index {
1041 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil; 1041 return index < [buttons_ count] ? [buttons_ objectAtIndex:index] : nil;
1042 } 1042 }
1043 1043
1044 @end 1044 @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