| Index: ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm
 | 
| diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm b/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm
 | 
| index e12d250be5d540501ce2fe629649074a121e0836..da55fb7293bae425573755d151ef387d1cc364f5 100644
 | 
| --- a/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm
 | 
| +++ b/ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.mm
 | 
| @@ -7,7 +7,10 @@
 | 
|  #include <memory>
 | 
|  #include <vector>
 | 
|  
 | 
| +#import "base/ios/weak_nsobject.h"
 | 
|  #include "base/logging.h"
 | 
| +#include "base/mac/objc_property_releaser.h"
 | 
| +#include "base/mac/scoped_nsobject.h"
 | 
|  #include "base/strings/sys_string_conversions.h"
 | 
|  #include "components/bookmarks/browser/bookmark_model.h"
 | 
|  #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller.h"
 | 
| @@ -21,10 +24,6 @@
 | 
|  #import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h"
 | 
|  #include "ui/base/l10n/l10n_util_mac.h"
 | 
|  
 | 
| -#if !defined(__has_feature) || !__has_feature(objc_arc)
 | 
| -#error "This file requires ARC support."
 | 
| -#endif
 | 
| -
 | 
|  using bookmarks::BookmarkNode;
 | 
|  
 | 
|  namespace {
 | 
| @@ -55,7 +54,9 @@
 | 
|    std::set<const BookmarkNode*> _editedNodes;
 | 
|    std::vector<const BookmarkNode*> _folders;
 | 
|    std::unique_ptr<bookmarks::BookmarkModelBridge> _modelBridge;
 | 
| -  MDCAppBar* _appBar;
 | 
| +  base::scoped_nsobject<MDCAppBar> _appBar;
 | 
| +  base::mac::ObjCPropertyReleaser
 | 
| +      _propertyReleaser_BookmarkFolderViewController;
 | 
|  }
 | 
|  
 | 
|  // Should the controller setup Cancel and Done buttons instead of a back button.
 | 
| @@ -71,7 +72,7 @@
 | 
|  @property(nonatomic, readonly) const BookmarkNode* selectedFolder;
 | 
|  
 | 
|  // The view controller to present when creating a new folder.
 | 
| -@property(nonatomic, strong)
 | 
| +@property(nonatomic, retain)
 | 
|      BookmarkFolderEditorViewController* folderAddController;
 | 
|  
 | 
|  // A linear list of folders.
 | 
| @@ -79,7 +80,7 @@
 | 
|      const std::vector<const BookmarkNode*>& folders;
 | 
|  
 | 
|  // The table view that displays the options and folders.
 | 
| -@property(nonatomic, strong) UITableView* tableView;
 | 
| +@property(nonatomic, retain) UITableView* tableView;
 | 
|  
 | 
|  // Returns the cell for the default section and the given |row|.
 | 
|  - (BookmarkFolderTableViewCell*)defaultSectionCellForRow:(NSInteger)row;
 | 
| @@ -125,6 +126,8 @@
 | 
|    DCHECK(selectedFolder == NULL || selectedFolder->is_folder());
 | 
|    self = [super initWithNibName:nil bundle:nil];
 | 
|    if (self) {
 | 
| +    _propertyReleaser_BookmarkFolderViewController.Init(
 | 
| +        self, [BookmarkFolderViewController class]);
 | 
|      _allowsCancel = allowsCancel;
 | 
|      _allowsNewFolders = allowsNewFolders;
 | 
|      _bookmarkModel = bookmarkModel;
 | 
| @@ -135,7 +138,7 @@
 | 
|      _modelBridge.reset(
 | 
|          new bookmarks::BookmarkModelBridge(self, _bookmarkModel));
 | 
|  
 | 
| -    _appBar = [[MDCAppBar alloc] init];
 | 
| +    _appBar.reset([[MDCAppBar alloc] init]);
 | 
|      [self addChildViewController:[_appBar headerViewController]];
 | 
|    }
 | 
|    return self;
 | 
| @@ -152,6 +155,7 @@
 | 
|    _tableView.dataSource = nil;
 | 
|    _tableView.delegate = nil;
 | 
|    _folderAddController.delegate = nil;
 | 
| +  [super dealloc];
 | 
|  }
 | 
|  
 | 
|  - (UIStatusBarStyle)preferredStatusBarStyle {
 | 
| @@ -170,13 +174,13 @@
 | 
|  
 | 
|    self.title = l10n_util::GetNSString(IDS_IOS_BOOKMARK_CHOOSE_GROUP_BUTTON);
 | 
|  
 | 
| -  UIBarButtonItem* doneItem = [[UIBarButtonItem alloc]
 | 
| +  base::scoped_nsobject<UIBarButtonItem> doneItem([[UIBarButtonItem alloc]
 | 
|        initWithTitle:l10n_util::GetNSString(
 | 
|                          IDS_IOS_BOOKMARK_EDIT_MODE_EXIT_MOBILE)
 | 
|                style:UIBarButtonItemStylePlain
 | 
|               target:self
 | 
| -             action:@selector(done:)];
 | 
| -  doneItem.accessibilityIdentifier = @"Done";
 | 
| +             action:@selector(done:)]);
 | 
| +  doneItem.get().accessibilityIdentifier = @"Done";
 | 
|    self.navigationItem.rightBarButtonItem = doneItem;
 | 
|  
 | 
|    if (self.allowsCancel) {
 | 
| @@ -200,14 +204,14 @@
 | 
|    }
 | 
|  
 | 
|    // The table view.
 | 
| -  UITableView* tableView =
 | 
| -      [[UITableView alloc] initWithFrame:self.view.bounds
 | 
| -                                   style:UITableViewStylePlain];
 | 
| -  tableView.dataSource = self;
 | 
| -  tableView.delegate = self;
 | 
| -  tableView.autoresizingMask =
 | 
| +  base::scoped_nsobject<UITableView> tableView([[UITableView alloc]
 | 
| +      initWithFrame:self.view.bounds
 | 
| +              style:UITableViewStylePlain]);
 | 
| +  tableView.get().dataSource = self;
 | 
| +  tableView.get().delegate = self;
 | 
| +  tableView.get().autoresizingMask =
 | 
|        UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
 | 
| -  tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
 | 
| +  tableView.get().separatorStyle = UITableViewCellSeparatorStyleNone;
 | 
|    [self.view addSubview:tableView];
 | 
|    [self.view sendSubviewToBack:tableView];
 | 
|    self.tableView = tableView;
 | 
| @@ -333,16 +337,18 @@
 | 
|    CGRect headerViewFrame =
 | 
|        CGRectMake(0, 0, CGRectGetWidth(tableView.frame),
 | 
|                   [self tableView:tableView heightForHeaderInSection:section]);
 | 
| -  UIView* headerView = [[UIView alloc] initWithFrame:headerViewFrame];
 | 
| +  UIView* headerView =
 | 
| +      [[[UIView alloc] initWithFrame:headerViewFrame] autorelease];
 | 
|    if (section == BookmarkFolderSectionFolders &&
 | 
|        [self shouldShowDefaultSection]) {
 | 
|      CGRect separatorFrame =
 | 
|          CGRectMake(0, 0, CGRectGetWidth(headerView.bounds),
 | 
|                     1.0 / [[UIScreen mainScreen] scale]);  // 1-pixel divider.
 | 
| -    UIView* separator = [[UIView alloc] initWithFrame:separatorFrame];
 | 
| -    separator.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin |
 | 
| -                                 UIViewAutoresizingFlexibleWidth;
 | 
| -    separator.backgroundColor = bookmark_utils_ios::separatorColor();
 | 
| +    base::scoped_nsobject<UIView> separator(
 | 
| +        [[UIView alloc] initWithFrame:separatorFrame]);
 | 
| +    separator.get().autoresizingMask = UIViewAutoresizingFlexibleBottomMargin |
 | 
| +                                       UIViewAutoresizingFlexibleWidth;
 | 
| +    separator.get().backgroundColor = bookmark_utils_ios::separatorColor();
 | 
|      [headerView addSubview:separator];
 | 
|    }
 | 
|    return headerView;
 | 
| @@ -363,7 +369,7 @@
 | 
|  
 | 
|  - (UIView*)tableView:(UITableView*)tableView
 | 
|      viewForFooterInSection:(NSInteger)section {
 | 
| -  return [[UIView alloc] init];
 | 
| +  return [[[UIView alloc] init] autorelease];
 | 
|  }
 | 
|  
 | 
|  - (void)tableView:(UITableView*)tableView
 | 
| @@ -532,15 +538,16 @@
 | 
|  
 | 
|  - (void)delayedNotifyDelegateOfSelection {
 | 
|    self.view.userInteractionEnabled = NO;
 | 
| -  __weak BookmarkFolderViewController* weakSelf = self;
 | 
| +  base::WeakNSObject<BookmarkFolderViewController> weakSelf(self);
 | 
|    dispatch_after(
 | 
|        dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)),
 | 
|        dispatch_get_main_queue(), ^{
 | 
| -        BookmarkFolderViewController* strongSelf = weakSelf;
 | 
| +        base::scoped_nsobject<BookmarkFolderViewController> strongSelf(
 | 
| +            [weakSelf retain]);
 | 
|          // Early return if the controller has been deallocated.
 | 
|          if (!strongSelf)
 | 
|            return;
 | 
| -        strongSelf.view.userInteractionEnabled = YES;
 | 
| +        strongSelf.get().view.userInteractionEnabled = YES;
 | 
|          [strongSelf done:nil];
 | 
|        });
 | 
|  }
 | 
| 
 |