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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_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 #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller. h" 4 #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_editor_view_controller. h"
5 5
6 #include <memory> 6 #include <memory>
7 #include <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
11 #import "base/ios/weak_nsobject.h" 11 #import "base/ios/weak_nsobject.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/mac/objc_property_releaser.h" 14 #include "base/mac/objc_release_properties.h"
15 #include "base/mac/scoped_nsobject.h" 15 #include "base/mac/scoped_nsobject.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/bookmarks/browser/bookmark_node.h" 18 #include "components/bookmarks/browser/bookmark_node.h"
19 #import "ios/chrome/browser/ui/bookmarks/bookmark_elevated_toolbar.h" 19 #import "ios/chrome/browser/ui/bookmarks/bookmark_elevated_toolbar.h"
20 #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.h" 20 #import "ios/chrome/browser/ui/bookmarks/bookmark_folder_view_controller.h"
21 #import "ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h" 21 #import "ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h"
22 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h" 22 #import "ios/chrome/browser/ui/bookmarks/bookmark_utils_ios.h"
23 #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item.h" 23 #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item.h"
24 #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item.h" 24 #import "ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item.h"
(...skipping 23 matching lines...) Expand all
48 ItemTypeParentFolder, 48 ItemTypeParentFolder,
49 }; 49 };
50 50
51 } // namespace 51 } // namespace
52 52
53 @interface BookmarkFolderEditorViewController ()< 53 @interface BookmarkFolderEditorViewController ()<
54 BookmarkFolderViewControllerDelegate, 54 BookmarkFolderViewControllerDelegate,
55 BookmarkModelBridgeObserver, 55 BookmarkModelBridgeObserver,
56 BookmarkTextFieldItemDelegate> { 56 BookmarkTextFieldItemDelegate> {
57 std::unique_ptr<bookmarks::BookmarkModelBridge> _modelBridge; 57 std::unique_ptr<bookmarks::BookmarkModelBridge> _modelBridge;
58 base::mac::ObjCPropertyReleaser
59 _propertyReleaser_BookmarkFolderEditorViewController;
60 // Flag to ignore bookmark model Move notifications when the move is performed 58 // Flag to ignore bookmark model Move notifications when the move is performed
61 // by this class. 59 // by this class.
62 BOOL _ignoresOwnMove; 60 BOOL _ignoresOwnMove;
63 } 61 }
64 @property(nonatomic, assign) BOOL editingExistingFolder; 62 @property(nonatomic, assign) BOOL editingExistingFolder;
65 @property(nonatomic, assign) bookmarks::BookmarkModel* bookmarkModel; 63 @property(nonatomic, assign) bookmarks::BookmarkModel* bookmarkModel;
66 @property(nonatomic, assign) ios::ChromeBrowserState* browserState; 64 @property(nonatomic, assign) ios::ChromeBrowserState* browserState;
67 @property(nonatomic, assign) const BookmarkNode* folder; 65 @property(nonatomic, assign) const BookmarkNode* folder;
68 @property(nonatomic, retain) BookmarkFolderViewController* folderViewController; 66 @property(nonatomic, retain) BookmarkFolderViewController* folderViewController;
69 @property(nonatomic, assign) const BookmarkNode* parentFolder; 67 @property(nonatomic, assign) const BookmarkNode* parentFolder;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return folderEditor.autorelease(); 135 return folderEditor.autorelease();
138 } 136 }
139 137
140 #pragma mark - Initialization 138 #pragma mark - Initialization
141 139
142 - (instancetype)initWithBookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel { 140 - (instancetype)initWithBookmarkModel:(bookmarks::BookmarkModel*)bookmarkModel {
143 DCHECK(bookmarkModel); 141 DCHECK(bookmarkModel);
144 DCHECK(bookmarkModel->loaded()); 142 DCHECK(bookmarkModel->loaded());
145 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; 143 self = [super initWithStyle:CollectionViewControllerStyleAppBar];
146 if (self) { 144 if (self) {
147 _propertyReleaser_BookmarkFolderEditorViewController.Init(
148 self, [BookmarkFolderEditorViewController class]);
149 _bookmarkModel = bookmarkModel; 145 _bookmarkModel = bookmarkModel;
150 146
151 // Set up the bookmark model oberver. 147 // Set up the bookmark model oberver.
152 _modelBridge.reset( 148 _modelBridge.reset(
153 new bookmarks::BookmarkModelBridge(self, _bookmarkModel)); 149 new bookmarks::BookmarkModelBridge(self, _bookmarkModel));
154 } 150 }
155 return self; 151 return self;
156 } 152 }
157 153
158 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style { 154 - (instancetype)initWithStyle:(CollectionViewControllerStyle)style {
159 NOTREACHED(); 155 NOTREACHED();
160 return nil; 156 return nil;
161 } 157 }
162 158
163 - (void)dealloc { 159 - (void)dealloc {
164 _titleItem.delegate = nil; 160 _titleItem.delegate = nil;
165 _folderViewController.delegate = nil; 161 _folderViewController.delegate = nil;
162 base::mac::ReleaseProperties(self);
166 [super dealloc]; 163 [super dealloc];
167 } 164 }
168 165
169 #pragma mark - UIViewController 166 #pragma mark - UIViewController
170 167
171 - (void)viewDidLoad { 168 - (void)viewDidLoad {
172 [super viewDidLoad]; 169 [super viewDidLoad];
173 self.collectionView.backgroundColor = [UIColor whiteColor]; 170 self.collectionView.backgroundColor = [UIColor whiteColor];
174 171
175 // Add Done button. 172 // Add Done button.
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 - (void)removeToolbar { 514 - (void)removeToolbar {
518 [self.toolbar removeFromSuperview]; 515 [self.toolbar removeFromSuperview];
519 self.toolbar = nil; 516 self.toolbar = nil;
520 } 517 }
521 518
522 - (void)updateSaveButtonState { 519 - (void)updateSaveButtonState {
523 self.doneItem.enabled = (self.titleItem.text.length > 0); 520 self.doneItem.enabled = (self.titleItem.text.length > 0);
524 } 521 }
525 522
526 @end 523 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698