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

Unified Diff: ios/chrome/browser/autofill/form_suggestion_label.mm

Issue 2933093003: [ObjC ARC] Converts ios/chrome/browser/autofill:autofill to ARC. (Closed)
Patch Set: Fix nil assignment. 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
Index: ios/chrome/browser/autofill/form_suggestion_label.mm
diff --git a/ios/chrome/browser/autofill/form_suggestion_label.mm b/ios/chrome/browser/autofill/form_suggestion_label.mm
index 6dbce0c31540f23460744b16bd36dae48abd497c..490becb39d2a0c9d35d9d6aa68aafead5387fe56 100644
--- a/ios/chrome/browser/autofill/form_suggestion_label.mm
+++ b/ios/chrome/browser/autofill/form_suggestion_label.mm
@@ -20,6 +20,10 @@
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
// The button corner radius.
@@ -64,7 +68,7 @@ const IconImageMap kCreditCardIconImageMap[] = {
// Creates a label with the given |text| and |alpha| suitable for use in a
// suggestion button in the keyboard accessory view.
UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
- base::scoped_nsobject<UILabel> label([[UILabel alloc] init]);
+ UILabel* label = [[UILabel alloc] init];
[label setText:text];
CGFloat fontSize = IsIPadIdiom() ? kIpadFontSize : kIphoneFontSize;
UIFont* font = bold ? [UIFont boldSystemFontOfSize:fontSize]
@@ -73,7 +77,7 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
[label setTextColor:[UIColor colorWithWhite:0.0f alpha:alpha]];
[label setBackgroundColor:[UIColor clearColor]];
[label sizeToFit];
- return label.autorelease();
+ return label;
}
} // namespace
@@ -86,8 +90,8 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
@implementation FormSuggestionLabel {
// Client of this view.
- base::WeakNSProtocol<id<FormSuggestionViewClient>> client_;
- base::scoped_nsobject<FormSuggestion> suggestion_;
+ __weak id<FormSuggestionViewClient> client_;
+ FormSuggestion* suggestion_;
}
- (id)initWithSuggestion:(FormSuggestion*)suggestion
@@ -99,8 +103,8 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
// layout in those methods instead of in the designated initializer.
self = [super initWithFrame:CGRectZero];
if (self) {
- suggestion_.reset([suggestion retain]);
- client_.reset(client);
+ suggestion_ = suggestion;
+ client_ = client;
const CGFloat frameHeight = CGRectGetHeight(proposedFrame);
CGFloat currentX = kBorderWidth;
@@ -113,8 +117,7 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
if (iconImageName)
iconImage = [UIImage imageNamed:iconImageName];
if (iconImage) {
- UIImageView* iconView =
- [[[UIImageView alloc] initWithImage:iconImage] autorelease];
+ UIImageView* iconView = [[UIImageView alloc] initWithImage:iconImage];
const CGFloat iconY =
std::floor((frameHeight - iconImage.size.height) / 2.0f);
iconView.frame = CGRectMake(currentX, iconY, iconImage.size.width,
« no previous file with comments | « ios/chrome/browser/autofill/form_suggestion_controller.mm ('k') | ios/chrome/browser/autofill/form_suggestion_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698