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

Unified Diff: ios/chrome/browser/ui/infobars/infobar_view.mm

Issue 2831293002: Change target+selector for block in InfoBarView (Closed)
Patch Set: Address comment Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/infobars/infobar_view.mm
diff --git a/ios/chrome/browser/ui/infobars/infobar_view.mm b/ios/chrome/browser/ui/infobars/infobar_view.mm
index a0a79f6b8e004623c8fca5ae463dd605754cadd1..88d913b3f893bcc7da6e1216947b71a761022c90 100644
--- a/ios/chrome/browser/ui/infobars/infobar_view.mm
+++ b/ios/chrome/browser/ui/infobars/infobar_view.mm
@@ -764,12 +764,12 @@ enum InfoBarButtonPosition { ON_FIRST_LINE, CENTER, LEFT, RIGHT };
}
- (void)addLabel:(NSString*)label {
- [self addLabel:label target:nil action:nil];
+ [self addLabel:label action:nil];
}
-- (void)addLabel:(NSString*)text target:(id)target action:(SEL)action {
+- (void)addLabel:(NSString*)text action:(void (^)(NSUInteger))action {
markedLabel_.reset([text copy]);
- if (target)
+ if (action)
text = [self stripMarkersFromString:text];
if ([label_ superview]) {
[label_ removeFromSuperview];
@@ -800,14 +800,14 @@ enum InfoBarButtonPosition { ON_FIRST_LINE, CENTER, LEFT, RIGHT };
if (linkRanges_.empty())
return;
- DCHECK([target respondsToSelector:action]);
-
labelLinkController_.reset([[LabelLinkController alloc]
initWithLabel:label_
action:^(const GURL& gurl) {
- NSUInteger actionTag = [base::SysUTF8ToNSString(
- gurl.ExtractFileName()) integerValue];
- [target performSelector:action withObject:@(actionTag)];
+ if (action) {
+ NSUInteger actionTag = [base::SysUTF8ToNSString(
+ gurl.ExtractFileName()) integerValue];
+ action(actionTag);
+ }
}]);
[labelLinkController_ setLinkUnderlineStyle:NSUnderlineStyleSingle];

Powered by Google App Engine
This is Rietveld 408576698