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 "ios/chrome/browser/ui/infobars/infobar_view.h" | 5 #import "ios/chrome/browser/ui/infobars/infobar_view.h" |
6 | 6 |
7 #import <CoreGraphics/CoreGraphics.h> | 7 #import <CoreGraphics/CoreGraphics.h> |
8 #import <QuartzCore/QuartzCore.h> | 8 #import <QuartzCore/QuartzCore.h> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 shadowY = -[shadow_ image].size.height; // Shadow above the infobar. | 651 shadowY = -[shadow_ image].size.height; // Shadow above the infobar. |
652 [shadow_ setFrame:CGRectMake(0, shadowY, self.bounds.size.width, | 652 [shadow_ setFrame:CGRectMake(0, shadowY, self.bounds.size.width, |
653 [shadow_ image].size.height)]; | 653 [shadow_ image].size.height)]; |
654 [shadow_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; | 654 [shadow_ setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; |
655 } | 655 } |
656 | 656 |
657 - (void)addCloseButtonWithTag:(NSInteger)tag | 657 - (void)addCloseButtonWithTag:(NSInteger)tag |
658 target:(id)target | 658 target:(id)target |
659 action:(SEL)action { | 659 action:(SEL)action { |
660 DCHECK(!closeButton_); | 660 DCHECK(!closeButton_); |
661 // TODO(jeanfrancoisg): Add IDR_ constant and use GetNativeImageNamed(). | 661 // TODO(crbug/228611): Add IDR_ constant and use GetNativeImageNamed(). |
662 // crbug/228611 | |
663 NSString* imagePath = | 662 NSString* imagePath = |
664 [[NSBundle mainBundle] pathForResource:@"infobar_close" ofType:@"png"]; | 663 [[NSBundle mainBundle] pathForResource:@"infobar_close" ofType:@"png"]; |
665 UIImage* image = [UIImage imageWithContentsOfFile:imagePath]; | 664 UIImage* image = [UIImage imageWithContentsOfFile:imagePath]; |
666 closeButton_.reset([[UIButton buttonWithType:UIButtonTypeCustom] retain]); | 665 closeButton_.reset([[UIButton buttonWithType:UIButtonTypeCustom] retain]); |
667 [closeButton_ setExclusiveTouch:YES]; | 666 [closeButton_ setExclusiveTouch:YES]; |
668 [closeButton_ setImage:image forState:UIControlStateNormal]; | 667 [closeButton_ setImage:image forState:UIControlStateNormal]; |
669 [closeButton_ addTarget:target | 668 [closeButton_ addTarget:target |
670 action:action | 669 action:action |
671 forControlEvents:UIControlEventTouchUpInside]; | 670 forControlEvents:UIControlEventTouchUpInside]; |
672 [closeButton_ setTag:tag]; | 671 [closeButton_ setTag:tag]; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 | 942 |
944 - (CGFloat)buttonMargin { | 943 - (CGFloat)buttonMargin { |
945 return kButtonMargin; | 944 return kButtonMargin; |
946 } | 945 } |
947 | 946 |
948 - (const std::vector<std::pair<NSUInteger, NSRange>>&)linkRanges { | 947 - (const std::vector<std::pair<NSUInteger, NSRange>>&)linkRanges { |
949 return linkRanges_; | 948 return linkRanges_; |
950 } | 949 } |
951 | 950 |
952 @end | 951 @end |
OLD | NEW |