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

Unified Diff: ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm

Issue 2626073003: [ObjC ARC] Converts ios/chrome/browser/ui/contextual_search:contextual_search to ARC. (Closed)
Patch Set: format 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm
diff --git a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm
index f156b866fcc44088d0a8f92190aad72580efb915..5656d85c8c53770ed37efb43cdffb9b9a9d863e4 100644
--- a/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm
+++ b/ios/chrome/browser/ui/contextual_search/contextual_search_header_view.mm
@@ -4,10 +4,8 @@
#import "ios/chrome/browser/ui/contextual_search/contextual_search_header_view.h"
-#import "base/ios/weak_nsobject.h"
#include "base/logging.h"
#include "base/mac/scoped_cftyperef.h"
-#include "base/mac/scoped_nsobject.h"
#import "ios/chrome/browser/ui/contextual_search/contextual_search_panel_view.h"
#import "ios/chrome/browser/ui/uikit_ui_util.h"
#import "ios/chrome/common/material_timing.h"
@@ -16,6 +14,10 @@
#include "ios/public/provider/chrome/browser/images/branded_image_provider.h"
#import "ios/third_party/material_components_ios/src/components/Typography/src/MaterialTypography.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
const CGFloat kHorizontalMargin = 24.0;
const CGFloat kHorizontalLayoutGap = 16.0;
@@ -105,8 +107,8 @@ const NSTimeInterval kLogoIrisAnimationDuration = ios::material::kDuration1;
// Label showing the text the user tapped on in the web page, and any
// additional context that will be displayed.
__unsafe_unretained UILabel* _textLabel;
- base::WeakNSProtocol<id<ContextualSearchPanelTapHandler>> _tapHandler;
- base::scoped_nsobject<UIGestureRecognizer> _tapRecognizer;
+ __weak id<ContextualSearchPanelTapHandler> _tapHandler;
+ UIGestureRecognizer* _tapRecognizer;
}
+ (BOOL)requiresConstraintBasedLayout {
@@ -122,27 +124,30 @@ const NSTimeInterval kLogoIrisAnimationDuration = ios::material::kDuration1;
self.translatesAutoresizingMaskIntoConstraints = NO;
self.backgroundColor = [UIColor whiteColor];
- _tapRecognizer.reset([[UITapGestureRecognizer alloc] init]);
+ _tapRecognizer = [[UITapGestureRecognizer alloc] init];
[self addGestureRecognizer:_tapRecognizer];
[_tapRecognizer addTarget:self action:@selector(panelWasTapped:)];
UIImage* logoImage = ios::GetChromeBrowserProvider()
->GetBrandedImageProvider()
->GetContextualSearchHeaderImage();
- _logo = [[[IrisingImageView alloc] initWithImage:logoImage] autorelease];
+ IrisingImageView* logo = [[IrisingImageView alloc] initWithImage:logoImage];
+ _logo = logo;
_logo.translatesAutoresizingMaskIntoConstraints = NO;
_logo.iris = 0.0;
- _caret = [[[UIImageView alloc]
- initWithImage:[UIImage imageNamed:@"expand_less"]] autorelease];
+ UIImageView* caret =
+ [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"expand_less"]];
+ _caret = caret;
_caret.translatesAutoresizingMaskIntoConstraints = NO;
[_caret setContentHuggingPriority:UILayoutPriorityDefaultHigh
forAxis:UILayoutConstraintAxisVertical];
[_caret setContentHuggingPriority:UILayoutPriorityDefaultHigh
forAxis:UILayoutConstraintAxisHorizontal];
- _closeButton =
- [[[TappableButton alloc] initWithFrame:CGRectZero] autorelease];
+ TappableButton* closeButton =
+ [[TappableButton alloc] initWithFrame:CGRectZero];
+ _closeButton = closeButton;
_closeButton.translatesAutoresizingMaskIntoConstraints = NO;
[_closeButton setImage:[UIImage imageNamed:@"card_close_button"]
forState:UIControlStateNormal];
@@ -154,7 +159,8 @@ const NSTimeInterval kLogoIrisAnimationDuration = ios::material::kDuration1;
forAxis:UILayoutConstraintAxisHorizontal];
_closeButton.alpha = 0;
- _textLabel = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease];
+ UILabel* textLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ _textLabel = textLabel;
_textLabel.translatesAutoresizingMaskIntoConstraints = NO;
_textLabel.font = [MDCTypography subheadFont];
_textLabel.textAlignment = NSTextAlignmentNatural;
@@ -227,7 +233,7 @@ const NSTimeInterval kLogoIrisAnimationDuration = ios::material::kDuration1;
action:@selector(closePanel)
forControlEvents:UIControlEventTouchUpInside];
}
- _tapHandler.reset(tapHandler);
+ _tapHandler = tapHandler;
if (_tapHandler) {
[_closeButton addTarget:_tapHandler
action:@selector(closePanel)
@@ -302,7 +308,7 @@ const NSTimeInterval kLogoIrisAnimationDuration = ios::material::kDuration1;
followingTextRange:(NSRange)followingTextRange
animated:(BOOL)animated {
NSMutableAttributedString* styledText =
- [[[NSMutableAttributedString alloc] initWithString:text] autorelease];
+ [[NSMutableAttributedString alloc] initWithString:text];
[styledText addAttribute:NSForegroundColorAttributeName
value:[UIColor colorWithWhite:0 alpha:0.71f]
range:followingTextRange];

Powered by Google App Engine
This is Rietveld 408576698