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

Unified Diff: ios/chrome/today_extension/interactive_label.mm

Issue 2938433002: [ObjC ARC] Converts ios/chrome/today_extension:today_extension to ARC. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « ios/chrome/today_extension/BUILD.gn ('k') | ios/chrome/today_extension/notification_center_url_button.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/today_extension/interactive_label.mm
diff --git a/ios/chrome/today_extension/interactive_label.mm b/ios/chrome/today_extension/interactive_label.mm
index cba913a80dc377b5f4b794b22f2d4784db9f64ef..614f350e878d327c85d16a244c994c79131e1f08 100644
--- a/ios/chrome/today_extension/interactive_label.mm
+++ b/ios/chrome/today_extension/interactive_label.mm
@@ -34,8 +34,8 @@
base::scoped_nsobject<NSString> _labelString;
base::scoped_nsobject<NSString> _buttonString;
base::scoped_nsobject<UITextView> _label;
- base::mac::ScopedBlock<ProceduralBlock> _linkBlock;
- base::mac::ScopedBlock<ProceduralBlock> _buttonBlock;
+ ProceduralBlock _linkBlock;
+ ProceduralBlock _buttonBlock;
base::scoped_nsobject<TransparentButton> _activationButton;
NSRange _buttonRange;
base::scoped_nsobject<NSMutableAttributedString> _attributedText;
@@ -67,7 +67,7 @@
NSString* prefixedString =
[NSString stringWithFormat:@"\u200B%@", labelString];
_labelString.reset([prefixedString copy]);
- _linkBlock.reset(linkBlock, base::scoped_policy::RETAIN);
+ _linkBlock = [linkBlock copy];
_label.reset([[NoSelectionUITextView alloc] initWithFrame:CGRectZero]);
[_label setTranslatesAutoresizingMaskIntoConstraints:NO];
@@ -99,7 +99,7 @@
BOOL showButton = buttonString && buttonBlock;
if (showButton) {
_buttonString.reset([buttonString copy]);
- _buttonBlock.reset(buttonBlock, base::scoped_policy::RETAIN);
+ _buttonBlock = [buttonBlock copy];
_activationButton.reset(
[[TransparentButton alloc] initWithFrame:CGRectZero]);
[_activationButton addTarget:self
@@ -112,14 +112,14 @@
[_activationButton setBorderColor:ui_util::BorderColor()];
[self addSubview:_activationButton];
[self bringSubviewToFront:_activationButton];
- _buttonTopConstraint.reset([[[_activationButton topAnchor]
- constraintEqualToAnchor:[self topAnchor]] retain]);
- _buttonLeftConstraint.reset([[[_activationButton leftAnchor]
- constraintEqualToAnchor:[self leftAnchor]] retain]);
- _buttonWidthConstraint.reset([[[_activationButton widthAnchor]
- constraintEqualToConstant:0] retain]);
- _buttonHeightConstraint.reset([[[_activationButton heightAnchor]
- constraintEqualToConstant:0] retain]);
+ _buttonTopConstraint.reset([[_activationButton topAnchor]
+ constraintEqualToAnchor:[self topAnchor]]);
+ _buttonLeftConstraint.reset([[_activationButton leftAnchor]
+ constraintEqualToAnchor:[self leftAnchor]]);
+ _buttonWidthConstraint.reset(
+ [[_activationButton widthAnchor] constraintEqualToConstant:0]);
+ _buttonHeightConstraint.reset(
+ [[_activationButton heightAnchor] constraintEqualToConstant:0]);
[NSLayoutConstraint activateConstraints:@[
_buttonTopConstraint, _buttonLeftConstraint, _buttonWidthConstraint,
_buttonHeightConstraint
@@ -233,12 +233,14 @@
- (BOOL)textView:(UITextView*)textView
shouldInteractWithURL:(NSURL*)URL
inRange:(NSRange)characterRange {
- _linkBlock.get()();
+ if (_linkBlock)
+ _linkBlock();
return NO;
}
- (void)buttonPressed:(id)sender {
- _buttonBlock.get()();
+ if (_buttonBlock)
+ _buttonBlock();
}
- (CGSize)intrinsicContentSize {
« no previous file with comments | « ios/chrome/today_extension/BUILD.gn ('k') | ios/chrome/today_extension/notification_center_url_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698