| Index: ios/chrome/browser/ui/settings/settings_navigation_controller.mm
 | 
| diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
 | 
| index 9f7b5db3e61bb1f8d78401b73f278358bada50b5..894f8c303cc9623e89185911f69603858c865a8e 100644
 | 
| --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
 | 
| +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
 | 
| @@ -5,9 +5,7 @@
 | 
|  #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
 | 
|  
 | 
|  #include "base/ios/ios_util.h"
 | 
| -#import "base/ios/weak_nsobject.h"
 | 
|  #include "base/mac/foundation_util.h"
 | 
| -#import "base/mac/scoped_nsobject.h"
 | 
|  #include "components/strings/grit/components_strings.h"
 | 
|  #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 | 
|  #include "ios/chrome/browser/sync/sync_setup_service.h"
 | 
| @@ -40,6 +38,10 @@
 | 
|  #include "ui/base/l10n/l10n_util.h"
 | 
|  #include "ui/base/l10n/l10n_util_mac.h"
 | 
|  
 | 
| +#if !defined(__has_feature) || !__has_feature(objc_arc)
 | 
| +#error "This file requires ARC support."
 | 
| +#endif
 | 
| +
 | 
|  // TODO(crbug.com/620361): Remove the entire class when iOS 9 is dropped.
 | 
|  @interface SettingsAppBarContainerViewController
 | 
|      : MDCAppBarContainerViewController
 | 
| @@ -100,10 +102,10 @@
 | 
|  
 | 
|  @implementation SettingsNavigationController {
 | 
|    ios::ChromeBrowserState* mainBrowserState_;  // weak
 | 
| -  base::WeakNSProtocol<id<SettingsNavigationControllerDelegate>> delegate_;
 | 
| +  __weak id<SettingsNavigationControllerDelegate> delegate_;
 | 
|    // Keeps a mapping between the view controllers that are wrapped to display an
 | 
|    // app bar and the containers that wrap them.
 | 
| -  base::scoped_nsobject<NSMutableDictionary> appBarContainedViewControllers_;
 | 
| +  NSMutableDictionary* appBarContainedViewControllers_;
 | 
|  }
 | 
|  
 | 
|  @synthesize shouldCommitSyncChangesOnDismissal =
 | 
| @@ -119,10 +121,9 @@
 | 
|                                                                        delegate:
 | 
|      (id<SettingsNavigationControllerDelegate>)delegate {
 | 
|    // clang-format on
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[SettingsCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState
 | 
| -           currentBrowserState:currentBrowserState]);
 | 
| +  UIViewController* controller = [[SettingsCollectionViewController alloc]
 | 
| +      initWithBrowserState:browserState
 | 
| +       currentBrowserState:currentBrowserState];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -134,9 +135,9 @@
 | 
|  + (SettingsNavigationController*)
 | 
|  newAccountsController:(ios::ChromeBrowserState*)browserState
 | 
|               delegate:(id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller([
 | 
| -      [AccountsCollectionViewController alloc] initWithBrowserState:browserState
 | 
| -                                          closeSettingsOnAddAccount:YES]);
 | 
| +  UIViewController* controller = [[AccountsCollectionViewController alloc]
 | 
| +           initWithBrowserState:browserState
 | 
| +      closeSettingsOnAddAccount:YES];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -149,10 +150,9 @@ newAccountsController:(ios::ChromeBrowserState*)browserState
 | 
|       newSyncController:(ios::ChromeBrowserState*)browserState
 | 
|  allowSwitchSyncAccount:(BOOL)allowSwitchSyncAccount
 | 
|                delegate:(id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[SyncSettingsCollectionViewController alloc]
 | 
| -            initWithBrowserState:browserState
 | 
| -          allowSwitchSyncAccount:allowSwitchSyncAccount]);
 | 
| +  UIViewController* controller = [[SyncSettingsCollectionViewController alloc]
 | 
| +        initWithBrowserState:browserState
 | 
| +      allowSwitchSyncAccount:allowSwitchSyncAccount];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -168,10 +168,9 @@ newUserFeedbackController:(ios::ChromeBrowserState*)browserState
 | 
|    DCHECK(ios::GetChromeBrowserProvider()
 | 
|               ->GetUserFeedbackProvider()
 | 
|               ->IsUserFeedbackEnabled());
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      ios::GetChromeBrowserProvider()
 | 
| -          ->GetUserFeedbackProvider()
 | 
| -          ->CreateViewController(dataSource));
 | 
| +  UIViewController* controller = ios::GetChromeBrowserProvider()
 | 
| +                                     ->GetUserFeedbackProvider()
 | 
| +                                     ->CreateViewController(dataSource);
 | 
|    DCHECK(controller);
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
| @@ -185,9 +184,9 @@ newUserFeedbackController:(ios::ChromeBrowserState*)browserState
 | 
|  newClearBrowsingDataController:(ios::ChromeBrowserState*)browserState
 | 
|                        delegate:
 | 
|                            (id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| +  UIViewController* controller =
 | 
|        [[ClearBrowsingDataCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState]);
 | 
| +          initWithBrowserState:browserState];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -200,9 +199,9 @@ newClearBrowsingDataController:(ios::ChromeBrowserState*)browserState
 | 
|  newContextualSearchController:(ios::ChromeBrowserState*)browserState
 | 
|                       delegate:
 | 
|                           (id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| +  UIViewController* controller =
 | 
|        [[ContextualSearchCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState]);
 | 
| +          initWithBrowserState:browserState];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -215,9 +214,9 @@ newContextualSearchController:(ios::ChromeBrowserState*)browserState
 | 
|  newSyncEncryptionPassphraseController:(ios::ChromeBrowserState*)browserState
 | 
|                               delegate:(id<SettingsNavigationControllerDelegate>)
 | 
|                                            delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| +  UIViewController* controller =
 | 
|        [[SyncEncryptionPassphraseCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState]);
 | 
| +          initWithBrowserState:browserState];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -229,9 +228,8 @@ newSyncEncryptionPassphraseController:(ios::ChromeBrowserState*)browserState
 | 
|  + (SettingsNavigationController*)
 | 
|  newNativeAppsController:(ios::ChromeBrowserState*)browserState
 | 
|                 delegate:(id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[NativeAppsCollectionViewController alloc]
 | 
| -          initWithURLRequestContextGetter:browserState->GetRequestContext()]);
 | 
| +  UIViewController* controller = [[NativeAppsCollectionViewController alloc]
 | 
| +      initWithURLRequestContextGetter:browserState->GetRequestContext()];
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
|                      browserState:browserState
 | 
| @@ -242,9 +240,8 @@ newNativeAppsController:(ios::ChromeBrowserState*)browserState
 | 
|  + (SettingsNavigationController*)
 | 
|  newSavePasswordsController:(ios::ChromeBrowserState*)browserState
 | 
|                    delegate:(id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[SavePasswordsCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState]);
 | 
| +  UIViewController* controller = [[SavePasswordsCollectionViewController alloc]
 | 
| +      initWithBrowserState:browserState];
 | 
|  
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
| @@ -265,12 +262,11 @@ newImportDataController:(ios::ChromeBrowserState*)browserState
 | 
|                fromEmail:(NSString*)fromEmail
 | 
|                  toEmail:(NSString*)toEmail
 | 
|               isSignedIn:(BOOL)isSignedIn {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[ImportDataCollectionViewController alloc]
 | 
| -          initWithDelegate:importDataDelegate
 | 
| -                 fromEmail:fromEmail
 | 
| -                   toEmail:toEmail
 | 
| -                isSignedIn:isSignedIn]);
 | 
| +  UIViewController* controller = [[ImportDataCollectionViewController alloc]
 | 
| +      initWithDelegate:importDataDelegate
 | 
| +             fromEmail:fromEmail
 | 
| +               toEmail:toEmail
 | 
| +            isSignedIn:isSignedIn];
 | 
|  
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
| @@ -286,9 +282,8 @@ newImportDataController:(ios::ChromeBrowserState*)browserState
 | 
|  + (SettingsNavigationController*)
 | 
|  newAutofillController:(ios::ChromeBrowserState*)browserState
 | 
|               delegate:(id<SettingsNavigationControllerDelegate>)delegate {
 | 
| -  base::scoped_nsobject<UIViewController> controller(
 | 
| -      [[AutofillCollectionViewController alloc]
 | 
| -          initWithBrowserState:browserState]);
 | 
| +  UIViewController* controller = [[AutofillCollectionViewController alloc]
 | 
| +      initWithBrowserState:browserState];
 | 
|  
 | 
|    SettingsNavigationController* nc = [[SettingsNavigationController alloc]
 | 
|        initWithRootViewController:controller
 | 
| @@ -313,7 +308,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|    self = [super initWithRootViewController:rootViewController];
 | 
|    if (self) {
 | 
|      mainBrowserState_ = browserState;
 | 
| -    delegate_.reset(delegate);
 | 
| +    delegate_ = delegate;
 | 
|      shouldCommitSyncChangesOnDismissal_ = YES;
 | 
|      [self configureUI];
 | 
|    }
 | 
| @@ -337,7 +332,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|  
 | 
|    // Reset the delegate to prevent any queued transitions from attempting to
 | 
|    // close the settings.
 | 
| -  delegate_.reset();
 | 
| +  delegate_ = nil;
 | 
|  }
 | 
|  
 | 
|  - (void)closeSettings {
 | 
| @@ -375,7 +370,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|        self.topViewController.navigationItem.rightBarButtonItem;
 | 
|    if (!rightButton)
 | 
|      return NO;
 | 
| -  base::scoped_nsobject<UIBarButtonItem> doneButton([self doneButton]);
 | 
| +  UIBarButtonItem* doneButton = [self doneButton];
 | 
|    return [rightButton style] == [doneButton style] &&
 | 
|           [[rightButton title] compare:[doneButton title]] == NSOrderedSame;
 | 
|  }
 | 
| @@ -391,11 +386,11 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|  - (UIBarButtonItem*)doneButton {
 | 
|    // Create a custom Done bar button item, as Material Navigation Bar does not
 | 
|    // handle a system UIBarButtonSystemItemDone item.
 | 
| -  return [[[UIBarButtonItem alloc]
 | 
| +  return [[UIBarButtonItem alloc]
 | 
|        initWithTitle:l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_DONE_BUTTON)
 | 
|                style:UIBarButtonItemStyleDone
 | 
|               target:self
 | 
| -             action:@selector(closeSettings)] autorelease];
 | 
| +             action:@selector(closeSettings)];
 | 
|  }
 | 
|  
 | 
|  - (UIBarButtonItem*)closeButton {
 | 
| @@ -410,11 +405,11 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|  - (UIBarButtonItem*)cancelButton {
 | 
|    // Create a custom Cancel bar button item, as Material Navigation Bar does not
 | 
|    // handle a system UIBarButtonSystemItemCancel item.
 | 
| -  return [[[UIBarButtonItem alloc]
 | 
| +  return [[UIBarButtonItem alloc]
 | 
|        initWithTitle:l10n_util::GetNSString(IDS_IOS_NAVIGATION_BAR_CANCEL_BUTTON)
 | 
|                style:UIBarButtonItemStyleDone
 | 
|               target:self
 | 
| -             action:@selector(closeSettings)] autorelease];
 | 
| +             action:@selector(closeSettings)];
 | 
|  }
 | 
|  
 | 
|  - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
 | 
| @@ -529,25 +524,24 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|        // it can just be forwarded it up the responder chain.
 | 
|        break;
 | 
|      case IDC_SHOW_ACCOUNTS_SETTINGS: {
 | 
| -      base::scoped_nsobject<UIViewController> controller(
 | 
| -          [[AccountsCollectionViewController alloc]
 | 
| -                   initWithBrowserState:mainBrowserState_
 | 
| -              closeSettingsOnAddAccount:NO]);
 | 
| +      UIViewController* controller = [[AccountsCollectionViewController alloc]
 | 
| +               initWithBrowserState:mainBrowserState_
 | 
| +          closeSettingsOnAddAccount:NO];
 | 
|        [self pushViewController:controller animated:YES];
 | 
|        return;
 | 
|      }
 | 
|      case IDC_SHOW_SYNC_SETTINGS: {
 | 
| -      base::scoped_nsobject<UIViewController> controller(
 | 
| +      UIViewController* controller =
 | 
|            [[SyncSettingsCollectionViewController alloc]
 | 
|                  initWithBrowserState:mainBrowserState_
 | 
| -              allowSwitchSyncAccount:YES]);
 | 
| +              allowSwitchSyncAccount:YES];
 | 
|        [self pushViewController:controller animated:YES];
 | 
|        return;
 | 
|      }
 | 
|      case IDC_SHOW_SYNC_PASSPHRASE_SETTINGS: {
 | 
| -      base::scoped_nsobject<UIViewController> controller(
 | 
| +      UIViewController* controller =
 | 
|            [[SyncEncryptionPassphraseCollectionViewController alloc]
 | 
| -              initWithBrowserState:mainBrowserState_]);
 | 
| +              initWithBrowserState:mainBrowserState_];
 | 
|        [self pushViewController:controller animated:YES];
 | 
|        return;
 | 
|      }
 | 
| @@ -565,7 +559,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|    if ([self presentedViewController]) {
 | 
|      return nil;
 | 
|    }
 | 
| -  base::WeakNSObject<SettingsNavigationController> weakSelf(self);
 | 
| +  __weak SettingsNavigationController* weakSelf = self;
 | 
|    return @[
 | 
|      [UIKeyCommand cr_keyCommandWithInput:UIKeyInputEscape
 | 
|                             modifierFlags:Cr_UIKeyModifierNone
 | 
| @@ -613,8 +607,8 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|    // wrapped in an MDCAppBarContainerViewController.
 | 
|    if (![controller conformsToProtocol:@protocol(AppBarPresenting)]) {
 | 
|      MDCAppBarContainerViewController* appBarContainer =
 | 
| -        [[[SettingsAppBarContainerViewController alloc]
 | 
| -            initWithContentViewController:controller] autorelease];
 | 
| +        [[SettingsAppBarContainerViewController alloc]
 | 
| +            initWithContentViewController:controller];
 | 
|  
 | 
|      // Configure the style.
 | 
|      ConfigureAppBarWithCardStyle(appBarContainer.appBar);
 | 
| @@ -654,7 +648,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|  // controller's pointer to itself.
 | 
|  - (void)registerAppBarContainer:(MDCAppBarContainerViewController*)container {
 | 
|    if (!appBarContainedViewControllers_) {
 | 
| -    appBarContainedViewControllers_.reset([[NSMutableDictionary alloc] init]);
 | 
| +    appBarContainedViewControllers_ = [[NSMutableDictionary alloc] init];
 | 
|    }
 | 
|    NSValue* key = [self keyForController:[container contentViewController]];
 | 
|    [appBarContainedViewControllers_ setObject:container forKey:key];
 | 
| @@ -676,7 +670,7 @@ initWithRootViewController:(UIViewController*)rootViewController
 | 
|  
 | 
|  // Returns the dictionary key to use when dealing with |controller|.
 | 
|  - (NSValue*)keyForController:(UIViewController*)controller {
 | 
| -  return [NSValue valueWithPointer:controller];
 | 
| +  return [NSValue valueWithNonretainedObject:controller];
 | 
|  }
 | 
|  
 | 
|  #pragma mark - UIResponder
 | 
| 
 |