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

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: Yank unrelated changes. Created 3 years, 10 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ios::ChromeBrowserState* _browserState; // Weak. 87 ios::ChromeBrowserState* _browserState; // Weak.
88 id<UrlLoader> _loader; // Weak. 88 id<UrlLoader> _loader; // Weak.
89 89
90 // The following 2 ivars both represent the set of nodes being edited. 90 // The following 2 ivars both represent the set of nodes being edited.
91 // The set is for fast lookup. 91 // The set is for fast lookup.
92 // The vector maintains the order that edit nodes were added. 92 // The vector maintains the order that edit nodes were added.
93 // Use the relevant instance methods to modify these two ivars in tandem. 93 // Use the relevant instance methods to modify these two ivars in tandem.
94 // DO NOT modify these two ivars directly. 94 // DO NOT modify these two ivars directly.
95 std::set<const BookmarkNode*> _editNodes; 95 std::set<const BookmarkNode*> _editNodes;
96 std::vector<const BookmarkNode*> _editNodesOrdered; 96 std::vector<const BookmarkNode*> _editNodesOrdered;
97
98 base::mac::ObjCPropertyReleaser
99 _propertyReleaser_BookmarkHomeTabletNTPController;
100 } 97 }
101 98
102 @property(nonatomic, retain) BookmarkPanelView* panelView; 99 @property(nonatomic, retain) BookmarkPanelView* panelView;
103 100
104 #pragma mark - Properties and methods akin to BookmarkHomeViewController 101 #pragma mark - Properties and methods akin to BookmarkHomeViewController
105 102
106 // Whether the view controller is in editing mode. 103 // Whether the view controller is in editing mode.
107 @property(nonatomic, assign) BOOL editing; 104 @property(nonatomic, assign) BOOL editing;
108 // The set of edited index paths. 105 // The set of edited index paths.
109 @property(nonatomic, retain) NSMutableArray* editIndexPaths; 106 @property(nonatomic, retain) NSMutableArray* editIndexPaths;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // Property declared in NewTabPagePanelProtocol. 297 // Property declared in NewTabPagePanelProtocol.
301 @synthesize delegate = _delegate; 298 @synthesize delegate = _delegate;
302 299
303 - (id)initWithLoader:(id<UrlLoader>)loader 300 - (id)initWithLoader:(id<UrlLoader>)loader
304 browserState:(ios::ChromeBrowserState*)browserState { 301 browserState:(ios::ChromeBrowserState*)browserState {
305 self = [super init]; 302 self = [super init];
306 if (self) { 303 if (self) {
307 DCHECK(browserState); 304 DCHECK(browserState);
308 _browserState = browserState->GetOriginalChromeBrowserState(); 305 _browserState = browserState->GetOriginalChromeBrowserState();
309 _loader = loader; 306 _loader = loader;
310 _propertyReleaser_BookmarkHomeTabletNTPController.Init(
311 self, [BookmarkHomeTabletNTPController class]);
312
313 _bookmarks = ios::BookmarkModelFactory::GetForBrowserState(_browserState); 307 _bookmarks = ios::BookmarkModelFactory::GetForBrowserState(_browserState);
314 _bridge.reset(new bookmarks::BookmarkModelBridge(self, _bookmarks)); 308 _bridge.reset(new bookmarks::BookmarkModelBridge(self, _bookmarks));
315 _editIndexPaths = [[NSMutableArray alloc] init]; 309 _editIndexPaths = [[NSMutableArray alloc] init];
316 // It is important to initialize the promo controller with the browser state 310 // It is important to initialize the promo controller with the browser state
317 // passed in, as it could be incognito. 311 // passed in, as it could be incognito.
318 _bookmarkPromoController = 312 _bookmarkPromoController =
319 [[BookmarkPromoController alloc] initWithBrowserState:browserState 313 [[BookmarkPromoController alloc] initWithBrowserState:browserState
320 delegate:self]; 314 delegate:self];
321 } 315 }
322 return self; 316 return self;
323 } 317 }
324 318
325 - (void)dealloc { 319 - (void)dealloc {
326 _contentView.delegate = nil; 320 _contentView.delegate = nil;
327 321
328 _folderView.delegate = nil; 322 _folderView.delegate = nil;
329 323
330 _menuView.delegate = nil; 324 _menuView.delegate = nil;
331 325
332 _editViewController.delegate = nil; 326 _editViewController.delegate = nil;
333 _folderSelector.delegate = nil; 327 _folderSelector.delegate = nil;
334 328
329 base::mac::ReleaseProperties(self);
335 [super dealloc]; 330 [super dealloc];
336 } 331 }
337 332
338 - (ios::ChromeBrowserState*)browserState { 333 - (ios::ChromeBrowserState*)browserState {
339 return _browserState; 334 return _browserState;
340 } 335 }
341 336
342 #pragma mark - ContentViewDelegate method. 337 #pragma mark - ContentViewDelegate method.
343 338
344 - (void)willLayoutSubviews { 339 - (void)willLayoutSubviews {
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 } 1284 }
1290 1285
1291 - (NSIndexPath*)indexPathForCell:(UICollectionViewCell*)cell { 1286 - (NSIndexPath*)indexPathForCell:(UICollectionViewCell*)cell {
1292 DCHECK([self primaryView].collectionView); 1287 DCHECK([self primaryView].collectionView);
1293 NSIndexPath* indexPath = 1288 NSIndexPath* indexPath =
1294 [[self primaryView].collectionView indexPathForCell:cell]; 1289 [[self primaryView].collectionView indexPathForCell:cell];
1295 return indexPath; 1290 return indexPath;
1296 } 1291 }
1297 1292
1298 @end 1293 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698