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

Side by Side Diff: ios/chrome/browser/ui/infobars/infobar_view.mm

Issue 2602903002: Factor iOS native image loading into a utility function. (Closed)
Patch Set: Fixed BUILD files. Created 3 years, 11 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
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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698