| Index: ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm | 
| diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm | 
| index 659afd722f593a54d9c8197a221c69bf4f12aebe..64020a711201f11c6d7ae81db8e1fc1865d881df 100644 | 
| --- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm | 
| +++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm | 
| @@ -9,8 +9,7 @@ | 
| #include "base/command_line.h" | 
| #include "base/logging.h" | 
| #include "base/mac/foundation_util.h" | 
| -#include "base/mac/objc_property_releaser.h" | 
| -#include "base/mac/scoped_nsobject.h" | 
| + | 
| #include "base/strings/sys_string_conversions.h" | 
| #include "components/grit/components_scaled_resources.h" | 
| #include "components/omnibox/browser/autocomplete_input.h" | 
| @@ -32,6 +31,10 @@ | 
| #import "ui/gfx/ios/NSString+CrStringDrawing.h" | 
| #include "ui/gfx/scoped_cg_context_save_gstate_mac.h" | 
|  | 
| +#if !defined(__has_feature) || !__has_feature(objc_arc) | 
| +#error "This file requires ARC support." | 
| +#endif | 
| + | 
| namespace { | 
| const CGFloat kFontSize = 16; | 
| const CGFloat kEditingRectX = 16; | 
| @@ -92,21 +95,16 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
|  | 
| @implementation OmniboxTextFieldIOS { | 
| // Currently selected chip text. Nil if no chip. | 
| -  base::scoped_nsobject<NSString> _chipText; | 
| -  base::scoped_nsobject<UILabel> _selection; | 
| -  base::scoped_nsobject<UILabel> _preEditStaticLabel; | 
| -  NSString* _preEditText; | 
| -  base::scoped_nsobject<UIFont> _font; | 
| -  base::scoped_nsobject<UIColor> _displayedTextColor; | 
| -  base::scoped_nsobject<UIColor> _displayedTintColor; | 
| -  UIColor* _selectedTextBackgroundColor; | 
| -  UIColor* _placeholderTextColor; | 
| +  NSString* _chipText; | 
| +  UILabel* _selection; | 
| +  UILabel* _preEditStaticLabel; | 
| +  UIFont* _font; | 
| +  UIColor* _displayedTextColor; | 
| +  UIColor* _displayedTintColor; | 
|  | 
| // The 'Copy URL' menu item is sometimes shown in the edit menu, so keep it | 
| // around to make adding/removing easier. | 
| -  base::scoped_nsobject<UIMenuItem> _copyUrlMenuItem; | 
| - | 
| -  base::mac::ObjCPropertyReleaser _propertyReleaser_OmniboxTextFieldIOS; | 
| +  UIMenuItem* _copyUrlMenuItem; | 
| } | 
|  | 
| @synthesize leftViewImageId = _leftViewImageId; | 
| @@ -130,15 +128,13 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| tintColor:(UIColor*)tintColor { | 
| self = [super initWithFrame:frame]; | 
| if (self) { | 
| -    _propertyReleaser_OmniboxTextFieldIOS.Init(self, | 
| -                                               [OmniboxTextFieldIOS class]); | 
| -    _font.reset([font retain]); | 
| -    _displayedTextColor.reset([textColor retain]); | 
| +    _font = font; | 
| +    _displayedTextColor = textColor; | 
| if (tintColor) { | 
| [self setTintColor:tintColor]; | 
| -      _displayedTintColor.reset([tintColor retain]); | 
| +      _displayedTintColor = tintColor; | 
| } else { | 
| -      _displayedTintColor.reset([self.tintColor retain]); | 
| +      _displayedTintColor = self.tintColor; | 
| } | 
| [self setFont:_font]; | 
| [self setTextColor:_displayedTextColor]; | 
| @@ -210,7 +206,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| [super selectAll:nil]; | 
| } | 
|  | 
| -  if (!_selection.get()) { | 
| +  if (!_selection) { | 
| [super touchesBegan:touches withEvent:event]; | 
| return; | 
| } | 
| @@ -221,7 +217,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| return; | 
|  | 
| // Accept selection. | 
| -  base::scoped_nsobject<NSString> newText([[self nsDisplayedText] copy]); | 
| +  NSString* newText = [[self nsDisplayedText] copy]; | 
| [self clearAutocompleteText]; | 
| [self setText:newText]; | 
| } | 
| @@ -244,22 +240,22 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| [self setPreEditText:self.text]; | 
|  | 
| // Adjusts the placement so static URL lines up perfectly with UITextField. | 
| -  DCHECK(!_preEditStaticLabel.get()); | 
| +  DCHECK(!_preEditStaticLabel); | 
| CGRect rect = [self preEditLabelRectForBounds:self.bounds]; | 
| -  _preEditStaticLabel.reset([[UILabel alloc] initWithFrame:rect]); | 
| -  _preEditStaticLabel.get().backgroundColor = [UIColor clearColor]; | 
| -  _preEditStaticLabel.get().opaque = YES; | 
| -  _preEditStaticLabel.get().font = _font; | 
| -  _preEditStaticLabel.get().textColor = _displayedTextColor; | 
| -  _preEditStaticLabel.get().lineBreakMode = NSLineBreakByTruncatingHead; | 
| +  _preEditStaticLabel = [[UILabel alloc] initWithFrame:rect]; | 
| +  _preEditStaticLabel.backgroundColor = [UIColor clearColor]; | 
| +  _preEditStaticLabel.opaque = YES; | 
| +  _preEditStaticLabel.font = _font; | 
| +  _preEditStaticLabel.textColor = _displayedTextColor; | 
| +  _preEditStaticLabel.lineBreakMode = NSLineBreakByTruncatingHead; | 
|  | 
| NSDictionary* attributes = | 
| @{NSBackgroundColorAttributeName : [self selectedTextBackgroundColor]}; | 
| -  base::scoped_nsobject<NSAttributedString> preEditString( | 
| +  NSAttributedString* preEditString = | 
| [[NSAttributedString alloc] initWithString:self.text | 
| -                                      attributes:attributes]); | 
| +                                      attributes:attributes]; | 
| [_preEditStaticLabel setAttributedText:preEditString]; | 
| -  _preEditStaticLabel.get().textAlignment = [self preEditTextAlignment]; | 
| +  _preEditStaticLabel.textAlignment = [self preEditTextAlignment]; | 
| [self addSubview:_preEditStaticLabel]; | 
| } | 
|  | 
| @@ -287,9 +283,9 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| // If the pre-edit text is wider than the omnibox, right-align the text so it | 
| // ends at the same x coord as the blue selection box. | 
| CGSize textSize = | 
| -      [_preEditStaticLabel.get().text cr_pixelAlignedSizeWithFont:_font]; | 
| +      [_preEditStaticLabel.text cr_pixelAlignedSizeWithFont:_font]; | 
| BOOL isLTR = [self bestTextAlignment] == NSTextAlignmentLeft; | 
| -  return textSize.width < _preEditStaticLabel.get().frame.size.width | 
| +  return textSize.width < _preEditStaticLabel.frame.size.width | 
| ? (isLTR ? NSTextAlignmentLeft : NSTextAlignmentRight) | 
| : (isLTR ? NSTextAlignmentRight : NSTextAlignmentLeft); | 
| } | 
| @@ -301,7 +297,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| [_preEditStaticLabel setFrame:rect]; | 
|  | 
| // Update text alignment since the pre-edit label's frame changed. | 
| -    _preEditStaticLabel.get().textAlignment = [self preEditTextAlignment]; | 
| +    _preEditStaticLabel.textAlignment = [self preEditTextAlignment]; | 
| [self hideTextAndCursor]; | 
| } else if (!_selection) { | 
| [self showTextAndCursor]; | 
| @@ -313,7 +309,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| [self setPreEditText:nil]; | 
| if (_preEditStaticLabel) { | 
| [_preEditStaticLabel removeFromSuperview]; | 
| -    _preEditStaticLabel.reset(nil); | 
| +    _preEditStaticLabel = nil; | 
| [self showTextAndCursor]; | 
| } | 
| } | 
| @@ -333,7 +329,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| } | 
|  | 
| - (NSString*)nsDisplayedText { | 
| -  if (_selection.get()) | 
| +  if (_selection) | 
| return [_selection text]; | 
| return [self text]; | 
| } | 
| @@ -346,7 +342,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| DCHECK_LT([[self text] length], [[_selection text] length]) | 
| << "[_selection text] and [self text] are out of sync. " | 
| << "Please email justincohen@ and rohitrao@ if you see this."; | 
| -  if (_selection.get() && [[_selection text] length] > [[self text] length]) { | 
| +  if (_selection && [[_selection text] length] > [[self text] length]) { | 
| return base::SysNSStringToUTF16( | 
| [[_selection text] substringFromIndex:[[self text] length]]); | 
| } | 
| @@ -364,8 +360,8 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| if ([self isPreEditing]) { | 
| [self exitPreEditState]; | 
| } | 
| -  if (_selection.get()) { | 
| -    base::scoped_nsobject<NSString> newText([[self nsDisplayedText] copy]); | 
| +  if (_selection) { | 
| +    NSString* newText = [[self nsDisplayedText] copy]; | 
| [self clearAutocompleteText]; | 
| [self setText:newText]; | 
| } | 
| @@ -375,10 +371,10 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| // Creates the SelectedTextLabel if it doesn't already exist and adds it as a | 
| // subview. | 
| - (void)createSelectionViewIfNecessary { | 
| -  if (_selection.get()) | 
| +  if (_selection) | 
| return; | 
|  | 
| -  _selection.reset([[UILabel alloc] initWithFrame:CGRectZero]); | 
| +  _selection = [[UILabel alloc] initWithFrame:CGRectZero]; | 
| [_selection setFont:_font]; | 
| [_selection setTextColor:_displayedTextColor]; | 
| [_selection setOpaque:NO]; | 
| @@ -408,8 +404,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| } else if (_leftViewImageId && (IsIPadIdiom() || ![self isFirstResponder])) { | 
| UIImage* image = [NativeImage(_leftViewImageId) | 
| imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; | 
| -    UIImageView* imageView = | 
| -        [[[UIImageView alloc] initWithImage:image] autorelease]; | 
| +    UIImageView* imageView = [[UIImageView alloc] initWithImage:image]; | 
| [leftViewButton setImage:imageView.image forState:UIControlStateNormal]; | 
| [leftViewButton setTitle:nil forState:UIControlStateNormal]; | 
| UIColor* tint = [UIColor whiteColor]; | 
| @@ -475,11 +470,11 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| // Creating |autocompleteText| from |[text string]| has the added bonus of | 
| // removing all the previously set attributes. This way the autocomplete | 
| // text doesn't have a highlighted protocol, etc. | 
| -    base::scoped_nsobject<NSMutableAttributedString> autocompleteText( | 
| -        [[NSMutableAttributedString alloc] initWithString:[text string]]); | 
| +    NSMutableAttributedString* autocompleteText = | 
| +        [[NSMutableAttributedString alloc] initWithString:[text string]]; | 
|  | 
| [self createSelectionViewIfNecessary]; | 
| -    DCHECK(_selection.get()); | 
| +    DCHECK(_selection); | 
| [autocompleteText | 
| addAttribute:NSBackgroundColorAttributeName | 
| value:[self selectedTextBackgroundColor] | 
| @@ -512,8 +507,7 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
|  | 
| // Ensures that attributedText always uses the proper style attributes. | 
| - (void)setAttributedText:(NSAttributedString*)attributedText { | 
| -  base::scoped_nsobject<NSMutableAttributedString> mutableText( | 
| -      [attributedText mutableCopy]); | 
| +  NSMutableAttributedString* mutableText = [attributedText mutableCopy]; | 
| NSRange entireString = NSMakeRange(0, [mutableText length]); | 
|  | 
| // Set the font. | 
| @@ -523,13 +517,12 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| if (self.editing) { | 
| // Hide the text when the |_selection| label is displayed. | 
| UIColor* textColor = | 
| -        _selection ? [UIColor clearColor] : _displayedTextColor.get(); | 
| +        _selection ? [UIColor clearColor] : _displayedTextColor; | 
| [mutableText addAttribute:NSForegroundColorAttributeName | 
| value:textColor | 
| range:entireString]; | 
| } else { | 
| -    base::scoped_nsobject<NSMutableParagraphStyle> style( | 
| -        [[NSMutableParagraphStyle alloc] init]); | 
| +    NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init]; | 
| // URLs have their text direction set to to LTR (avoids RTL characters | 
| // making the URL render from right to left, as per RFC 3987 Section 4.1). | 
| [style setBaseWritingDirection:NSWritingDirectionLeftToRight]; | 
| @@ -579,16 +572,15 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| NSDictionary* attributes = | 
| @{NSForegroundColorAttributeName : _placeholderTextColor}; | 
| self.attributedPlaceholder = | 
| -        [[[NSAttributedString alloc] initWithString:placeholder | 
| -                                         attributes:attributes] autorelease]; | 
| +        [[NSAttributedString alloc] initWithString:placeholder | 
| +                                        attributes:attributes]; | 
| } else { | 
| [super setPlaceholder:placeholder]; | 
| } | 
| } | 
|  | 
| - (void)setText:(NSString*)text { | 
| -  NSAttributedString* as = | 
| -      [[[NSAttributedString alloc] initWithString:text] autorelease]; | 
| +  NSAttributedString* as = [[NSAttributedString alloc] initWithString:text]; | 
| if (self.text.length > 0 && as.length == 0) { | 
| // Remove the fade animations before the subviews are removed. | 
| [self cleanUpFadeAnimations]; | 
| @@ -605,23 +597,23 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| } | 
|  | 
| - (void)setChipText:(NSString*)chipName { | 
| -  _chipText.reset(); | 
| +  _chipText = nil; | 
| if ([chipName length]) { | 
| if ([self bestAlignmentForText:chipName] == NSTextAlignmentLeft) | 
| chipName = [chipName stringByAppendingString:@":"]; | 
| -    _chipText.reset([chipName copy]); | 
| +    _chipText = [chipName copy]; | 
| } | 
| [self updateLeftView]; | 
| } | 
|  | 
| - (BOOL)hasAutocompleteText { | 
| -  return !!_selection.get(); | 
| +  return !!_selection; | 
| } | 
|  | 
| - (void)clearAutocompleteText { | 
| if (_selection) { | 
| [_selection removeFromSuperview]; | 
| -    _selection.reset(nil); | 
| +    _selection = nil; | 
| [self showTextAndCursor]; | 
| } | 
| } | 
| @@ -992,10 +984,10 @@ NSString* const kOmniboxFadeAnimationKey = @"OmniboxFadeAnimation"; | 
| if (![super becomeFirstResponder]) | 
| return NO; | 
|  | 
| -  if (!_copyUrlMenuItem.get()) { | 
| +  if (!_copyUrlMenuItem) { | 
| NSString* const kTitle = l10n_util::GetNSString(IDS_IOS_COPY_URL); | 
| -    _copyUrlMenuItem.reset( | 
| -        [[UIMenuItem alloc] initWithTitle:kTitle action:@selector(copyUrl:)]); | 
| +    _copyUrlMenuItem = | 
| +        [[UIMenuItem alloc] initWithTitle:kTitle action:@selector(copyUrl:)]; | 
| } | 
|  | 
| // Add the "Copy URL" menu item to the |sharedMenuController| if necessary. | 
|  |