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

Unified Diff: ios/chrome/browser/ui/bookmarks/bookmark_menu_view.mm

Issue 2746473003: [ObjC ARC] Converts ios/chrome/browser/ui/bookmarks:bookmarks to ARC. (Closed)
Patch Set: fix test Created 3 years, 9 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/bookmarks/bookmark_menu_view.mm
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_menu_view.mm b/ios/chrome/browser/ui/bookmarks/bookmark_menu_view.mm
index dfbe201a4b94cfd280a410fdb409931b7629b160..106fadf0182d505946e01f9b90bd195de193aa75 100644
--- a/ios/chrome/browser/ui/bookmarks/bookmark_menu_view.mm
+++ b/ios/chrome/browser/ui/bookmarks/bookmark_menu_view.mm
@@ -7,8 +7,7 @@
#include <memory>
#include "base/mac/foundation_util.h"
-#include "base/mac/objc_property_releaser.h"
-#include "base/mac/scoped_nsobject.h"
+
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_model_observer.h"
#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
@@ -26,6 +25,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/tree_node_iterator.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
using bookmarks::BookmarkNode;
@interface BookmarkMenuView ()<BookmarkModelBridgeObserver,
@@ -34,17 +37,15 @@ using bookmarks::BookmarkNode;
UITableViewDelegate> {
// A bridge to receive bookmark model observer callbacks.
std::unique_ptr<bookmarks::BookmarkModelBridge> _modelBridge;
-
- base::mac::ObjCPropertyReleaser _propertyReleaser_BookmarkMenuView;
}
@property(nonatomic, assign) bookmarks::BookmarkModel* bookmarkModel;
// This array directly represents the rows that show up in the table.
-@property(nonatomic, retain) NSMutableArray* menuItems;
+@property(nonatomic, strong) NSMutableArray* menuItems;
// The primary menu item is blue instead of gray.
-@property(nonatomic, retain) BookmarkMenuItem* primaryMenuItem;
+@property(nonatomic, strong) BookmarkMenuItem* primaryMenuItem;
@property(nonatomic, assign) ios::ChromeBrowserState* browserState;
-@property(nonatomic, retain) UITableView* tableView;
-@property(nonatomic, retain) MDCInkTouchController* inkTouchController;
+@property(nonatomic, strong) UITableView* tableView;
+@property(nonatomic, strong) MDCInkTouchController* inkTouchController;
// Updates the data model, and the UI.
- (void)reloadData;
@@ -72,8 +73,6 @@ using bookmarks::BookmarkNode;
frame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
- _propertyReleaser_BookmarkMenuView.Init(self, [BookmarkMenuView class]);
-
_browserState = browserState;
// Set up connection to the BookmarkModel.
@@ -93,13 +92,11 @@ using bookmarks::BookmarkNode;
- (void)dealloc {
self.tableView.delegate = nil;
self.tableView.dataSource = nil;
- [super dealloc];
}
- (void)createViews {
// Make the table view.
- self.tableView = base::scoped_nsobject<UITableView>(
- [[UITableView alloc] initWithFrame:self.bounds]);
+ self.tableView = [[UITableView alloc] initWithFrame:self.bounds];
[self addSubview:self.tableView];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.delegate = self;
@@ -108,8 +105,8 @@ using bookmarks::BookmarkNode;
[self reloadData];
// Set up ink touch controller.
- base::scoped_nsobject<MDCInkTouchController> inkTouchController(
- [[MDCInkTouchController alloc] initWithView:self.tableView]);
+ MDCInkTouchController* inkTouchController =
+ [[MDCInkTouchController alloc] initWithView:self.tableView];
self.inkTouchController = inkTouchController;
self.inkTouchController.delegate = self;
self.inkTouchController.delaysInkSpread = YES;
@@ -133,8 +130,7 @@ using bookmarks::BookmarkNode;
const BookmarkNode* otherBookmarks = self.bookmarkModel->other_node();
// The first section is always visible.
- base::scoped_nsobject<NSMutableArray> topSection(
- [[NSMutableArray alloc] init]);
+ NSMutableArray* topSection = [[NSMutableArray alloc] init];
[self.menuItems addObject:topSection];
// Mobile bookmark is shown even if empty.
@@ -155,8 +151,7 @@ using bookmarks::BookmarkNode;
// The second section contains all the top level folders (except for the
// permanent nodes).
- base::scoped_nsobject<NSMutableArray> folderSection(
- [[NSMutableArray alloc] init]);
+ NSMutableArray* folderSection = [[NSMutableArray alloc] init];
std::vector<const BookmarkNode*> rootLevelFolders =
RootLevelFolders(self.bookmarkModel);
bookmark_utils_ios::SortFolders(&rootLevelFolders);
@@ -312,9 +307,9 @@ using bookmarks::BookmarkNode;
BookmarkMenuCell* cell = [tableView
dequeueReusableCellWithIdentifier:[BookmarkMenuCell reuseIdentifier]];
if (!cell) {
- cell = [[[BookmarkMenuCell alloc]
+ cell = [[BookmarkMenuCell alloc]
initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:[BookmarkMenuCell reuseIdentifier]] autorelease];
+ reuseIdentifier:[BookmarkMenuCell reuseIdentifier]];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
BookmarkMenuItem* menuItem = [self menuItemAtIndexPath:indexPath];
@@ -371,12 +366,12 @@ using bookmarks::BookmarkNode;
- (UIView*)tableView:(UITableView*)tableView
viewForHeaderInSection:(NSInteger)section {
- return [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ return [[UIView alloc] initWithFrame:CGRectZero];
}
- (UIView*)tableView:(UITableView*)tableView
viewForFooterInSection:(NSInteger)section {
- return [[[UIView alloc] initWithFrame:CGRectZero] autorelease];
+ return [[UIView alloc] initWithFrame:CGRectZero];
}
#pragma mark MDCInkTouchControllerDelegate
« no previous file with comments | « ios/chrome/browser/ui/bookmarks/bookmark_menu_view.h ('k') | ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698