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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_home_tablet_ntp_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: weak -> assign Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_tablet_ntp_controller.h" 5 #import "ios/chrome/browser/ui/bookmarks/bookmark_home_tablet_ntp_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/ios/block_types.h" 9 #include "base/ios/block_types.h"
10 #import "base/ios/weak_nsobject.h" 10 #import "base/ios/weak_nsobject.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/mac/objc_property_releaser.h" 12 #include "base/mac/objc_release_properties.h"
13 #include "base/mac/scoped_nsobject.h" 13 #include "base/mac/scoped_nsobject.h"
14 #include "base/metrics/user_metrics.h" 14 #include "base/metrics/user_metrics.h"
15 #include "base/metrics/user_metrics_action.h" 15 #include "base/metrics/user_metrics_action.h"
16 #include "base/strings/sys_string_conversions.h" 16 #include "base/strings/sys_string_conversions.h"
17 #include "components/bookmarks/browser/bookmark_model.h" 17 #include "components/bookmarks/browser/bookmark_model.h"
18 #include "components/strings/grit/components_strings.h" 18 #include "components/strings/grit/components_strings.h"
19 #include "google_apis/gaia/google_service_auth_error.h" 19 #include "google_apis/gaia/google_service_auth_error.h"
20 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" 20 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
21 #include "ios/chrome/browser/bookmarks/bookmarks_utils.h" 21 #include "ios/chrome/browser/bookmarks/bookmarks_utils.h"
22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 22 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ios::ChromeBrowserState* _browserState; // Weak. 88 ios::ChromeBrowserState* _browserState; // Weak.
89 id<UrlLoader> _loader; // Weak. 89 id<UrlLoader> _loader; // Weak.
90 90
91 // The following 2 ivars both represent the set of nodes being edited. 91 // The following 2 ivars both represent the set of nodes being edited.
92 // The set is for fast lookup. 92 // The set is for fast lookup.
93 // The vector maintains the order that edit nodes were added. 93 // The vector maintains the order that edit nodes were added.
94 // Use the relevant instance methods to modify these two ivars in tandem. 94 // Use the relevant instance methods to modify these two ivars in tandem.
95 // DO NOT modify these two ivars directly. 95 // DO NOT modify these two ivars directly.
96 std::set<const BookmarkNode*> _editNodes; 96 std::set<const BookmarkNode*> _editNodes;
97 std::vector<const BookmarkNode*> _editNodesOrdered; 97 std::vector<const BookmarkNode*> _editNodesOrdered;
98
99 base::mac::ObjCPropertyReleaser
100 _propertyReleaser_BookmarkHomeTabletNTPController;
101 } 98 }
102 99
103 @property(nonatomic, retain) BookmarkPanelView* panelView; 100 @property(nonatomic, retain) BookmarkPanelView* panelView;
104 101
105 #pragma mark - Properties and methods akin to BookmarkHomeViewController 102 #pragma mark - Properties and methods akin to BookmarkHomeViewController
106 103
107 // Whether the view controller is in editing mode. 104 // Whether the view controller is in editing mode.
108 @property(nonatomic, assign) BOOL editing; 105 @property(nonatomic, assign) BOOL editing;
109 // The set of edited index paths. 106 // The set of edited index paths.
110 @property(nonatomic, retain) NSMutableArray* editIndexPaths; 107 @property(nonatomic, retain) NSMutableArray* editIndexPaths;
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // Property declared in NewTabPagePanelProtocol. 301 // Property declared in NewTabPagePanelProtocol.
305 @synthesize delegate = _delegate; 302 @synthesize delegate = _delegate;
306 303
307 - (id)initWithLoader:(id<UrlLoader>)loader 304 - (id)initWithLoader:(id<UrlLoader>)loader
308 browserState:(ios::ChromeBrowserState*)browserState { 305 browserState:(ios::ChromeBrowserState*)browserState {
309 self = [super init]; 306 self = [super init];
310 if (self) { 307 if (self) {
311 DCHECK(browserState); 308 DCHECK(browserState);
312 _browserState = browserState->GetOriginalChromeBrowserState(); 309 _browserState = browserState->GetOriginalChromeBrowserState();
313 _loader = loader; 310 _loader = loader;
314 _propertyReleaser_BookmarkHomeTabletNTPController.Init(
315 self, [BookmarkHomeTabletNTPController class]);
316
317 _bookmarks = ios::BookmarkModelFactory::GetForBrowserState(_browserState); 311 _bookmarks = ios::BookmarkModelFactory::GetForBrowserState(_browserState);
318 _bridge.reset(new bookmarks::BookmarkModelBridge(self, _bookmarks)); 312 _bridge.reset(new bookmarks::BookmarkModelBridge(self, _bookmarks));
319 _editIndexPaths = [[NSMutableArray alloc] init]; 313 _editIndexPaths = [[NSMutableArray alloc] init];
320 // It is important to initialize the promo controller with the browser state 314 // It is important to initialize the promo controller with the browser state
321 // passed in, as it could be incognito. 315 // passed in, as it could be incognito.
322 _bookmarkPromoController = 316 _bookmarkPromoController =
323 [[BookmarkPromoController alloc] initWithBrowserState:browserState 317 [[BookmarkPromoController alloc] initWithBrowserState:browserState
324 delegate:self]; 318 delegate:self];
325 } 319 }
326 return self; 320 return self;
327 } 321 }
328 322
329 - (void)dealloc { 323 - (void)dealloc {
330 _contentView.delegate = nil; 324 _contentView.delegate = nil;
331 325
332 _allItemsView.delegate = nil; 326 _allItemsView.delegate = nil;
333 _folderView.delegate = nil; 327 _folderView.delegate = nil;
334 328
335 _menuView.delegate = nil; 329 _menuView.delegate = nil;
336 330
337 _editViewController.delegate = nil; 331 _editViewController.delegate = nil;
338 _folderSelector.delegate = nil; 332 _folderSelector.delegate = nil;
339 333
334 base::mac::ReleaseProperties(self);
340 [super dealloc]; 335 [super dealloc];
341 } 336 }
342 337
343 - (ios::ChromeBrowserState*)browserState { 338 - (ios::ChromeBrowserState*)browserState {
344 return _browserState; 339 return _browserState;
345 } 340 }
346 341
347 #pragma mark - ContentViewDelegate method. 342 #pragma mark - ContentViewDelegate method.
348 343
349 - (void)willLayoutSubviews { 344 - (void)willLayoutSubviews {
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 } 1331 }
1337 1332
1338 - (NSIndexPath*)indexPathForCell:(UICollectionViewCell*)cell { 1333 - (NSIndexPath*)indexPathForCell:(UICollectionViewCell*)cell {
1339 DCHECK([self primaryView].collectionView); 1334 DCHECK([self primaryView].collectionView);
1340 NSIndexPath* indexPath = 1335 NSIndexPath* indexPath =
1341 [[self primaryView].collectionView indexPathForCell:cell]; 1336 [[self primaryView].collectionView indexPathForCell:cell];
1342 return indexPath; 1337 return indexPath;
1343 } 1338 }
1344 1339
1345 @end 1340 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698