| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |