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 "browser_actions_controller.h" | 5 #import "browser_actions_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 for (BrowserActionButton* button in [buttons_ allValues]) { | 581 for (BrowserActionButton* button in [buttons_ allValues]) { |
582 NSRect buttonFrame = [button frame]; | 582 NSRect buttonFrame = [button frame]; |
583 if (NSContainsRect([containerView_ bounds], buttonFrame)) { | 583 if (NSContainsRect([containerView_ bounds], buttonFrame)) { |
584 if ([button alphaValue] != 1.0) | 584 if ([button alphaValue] != 1.0) |
585 [button setAlphaValue:1.0]; | 585 [button setAlphaValue:1.0]; |
586 | 586 |
587 continue; | 587 continue; |
588 } | 588 } |
589 CGFloat intersectionWidth = | 589 CGFloat intersectionWidth = |
590 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); | 590 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); |
591 CGFloat alpha = std::max(0.0f, intersectionWidth / NSWidth(buttonFrame)); | 591 CGFloat alpha = std::max(static_cast<CGFloat>(0.0), |
| 592 intersectionWidth / NSWidth(buttonFrame)); |
592 [button setAlphaValue:alpha]; | 593 [button setAlphaValue:alpha]; |
593 [button setNeedsDisplay:YES]; | 594 [button setNeedsDisplay:YES]; |
594 } | 595 } |
595 } | 596 } |
596 | 597 |
597 - (BrowserActionButton*)buttonForExtension:(const Extension*)extension { | 598 - (BrowserActionButton*)buttonForExtension:(const Extension*)extension { |
598 NSString* extensionId = base::SysUTF8ToNSString(extension->id()); | 599 NSString* extensionId = base::SysUTF8ToNSString(extension->id()); |
599 DCHECK(extensionId); | 600 DCHECK(extensionId); |
600 if (!extensionId) | 601 if (!extensionId) |
601 return nil; | 602 return nil; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 const extensions::ExtensionList& toolbar_items = | 863 const extensions::ExtensionList& toolbar_items = |
863 toolbarModel_->toolbar_items(); | 864 toolbarModel_->toolbar_items(); |
864 if (index < toolbar_items.size()) { | 865 if (index < toolbar_items.size()) { |
865 const Extension* extension = toolbar_items[index]; | 866 const Extension* extension = toolbar_items[index]; |
866 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 867 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
867 } | 868 } |
868 return nil; | 869 return nil; |
869 } | 870 } |
870 | 871 |
871 @end | 872 @end |
OLD | NEW |