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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
552 for (BrowserActionButton* button in [buttons_ allValues]) { | 552 for (BrowserActionButton* button in [buttons_ allValues]) { |
553 NSRect buttonFrame = [button frame]; | 553 NSRect buttonFrame = [button frame]; |
554 if (NSContainsRect([containerView_ bounds], buttonFrame)) { | 554 if (NSContainsRect([containerView_ bounds], buttonFrame)) { |
555 if ([button alphaValue] != 1.0) | 555 if ([button alphaValue] != 1.0) |
556 [button setAlphaValue:1.0]; | 556 [button setAlphaValue:1.0]; |
557 | 557 |
558 continue; | 558 continue; |
559 } | 559 } |
560 CGFloat intersectionWidth = | 560 CGFloat intersectionWidth = |
561 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); | 561 NSWidth(NSIntersectionRect([containerView_ bounds], buttonFrame)); |
562 CGFloat alpha = std::max(0.0f, intersectionWidth / NSWidth(buttonFrame)); | 562 CGFloat alpha = std::max(static_cast<CGFloat>(0.0f), |
Mark Mentovai
2012/08/20 13:25:58
“0.0” means “zero as a double,” whereas “0.0f” mea
| |
563 intersectionWidth / NSWidth(buttonFrame)); | |
563 [button setAlphaValue:alpha]; | 564 [button setAlphaValue:alpha]; |
564 [button setNeedsDisplay:YES]; | 565 [button setNeedsDisplay:YES]; |
565 } | 566 } |
566 } | 567 } |
567 | 568 |
568 - (BrowserActionButton*)buttonForExtension:(const Extension*)extension { | 569 - (BrowserActionButton*)buttonForExtension:(const Extension*)extension { |
569 NSString* extensionId = base::SysUTF8ToNSString(extension->id()); | 570 NSString* extensionId = base::SysUTF8ToNSString(extension->id()); |
570 DCHECK(extensionId); | 571 DCHECK(extensionId); |
571 if (!extensionId) | 572 if (!extensionId) |
572 return nil; | 573 return nil; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 const extensions::ExtensionList& toolbar_items = | 834 const extensions::ExtensionList& toolbar_items = |
834 toolbarModel_->toolbar_items(); | 835 toolbarModel_->toolbar_items(); |
835 if (index < toolbar_items.size()) { | 836 if (index < toolbar_items.size()) { |
836 const Extension* extension = toolbar_items[index]; | 837 const Extension* extension = toolbar_items[index]; |
837 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; | 838 return [buttons_ objectForKey:base::SysUTF8ToNSString(extension->id())]; |
838 } | 839 } |
839 return nil; | 840 return nil; |
840 } | 841 } |
841 | 842 |
842 @end | 843 @end |
OLD | NEW |