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

Side by Side Diff: ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm

Issue 2610923005: Replace ObjCPropertyReleaser with ReleaseProperties() project-wide. (Closed)
Patch Set: Rebase Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/settings/save_passwords_collection_view_controlle r.h" 5 #import "ios/chrome/browser/ui/settings/save_passwords_collection_view_controlle r.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/ios/ios_util.h" 10 #include "base/ios/ios_util.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 #import "base/mac/objc_property_releaser.h" 14 #import "base/mac/objc_release_properties.h"
15 #import "base/mac/scoped_nsobject.h" 15 #import "base/mac/scoped_nsobject.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/numerics/safe_conversions.h" 17 #include "base/numerics/safe_conversions.h"
18 #include "base/strings/sys_string_conversions.h" 18 #include "base/strings/sys_string_conversions.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "components/autofill/core/common/password_form.h" 20 #include "components/autofill/core/common/password_form.h"
21 #include "components/google/core/browser/google_util.h" 21 #include "components/google/core/browser/google_util.h"
22 #include "components/keyed_service/core/service_access_type.h" 22 #include "components/keyed_service/core/service_access_type.h"
23 #include "components/password_manager/core/browser/affiliation_utils.h" 23 #include "components/password_manager/core/browser/affiliation_utils.h"
24 #include "components/password_manager/core/browser/password_manager_constants.h" 24 #include "components/password_manager/core/browser/password_manager_constants.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // The current Chrome browser state. 155 // The current Chrome browser state.
156 ios::ChromeBrowserState* browserState_; 156 ios::ChromeBrowserState* browserState_;
157 // Object storing the time of the previous successful re-authentication. 157 // Object storing the time of the previous successful re-authentication.
158 // This is meant to be used by the |ReauthenticationModule| for keeping 158 // This is meant to be used by the |ReauthenticationModule| for keeping
159 // re-authentications valid for a certain time interval within the scope 159 // re-authentications valid for a certain time interval within the scope
160 // of the Save Passwords Settings. 160 // of the Save Passwords Settings.
161 base::scoped_nsobject<NSDate> successfulReauthTime_; 161 base::scoped_nsobject<NSDate> successfulReauthTime_;
162 // Module containing the reauthentication mechanism for viewing and copying 162 // Module containing the reauthentication mechanism for viewing and copying
163 // passwords. 163 // passwords.
164 base::scoped_nsobject<ReauthenticationModule> reauthenticationModule_; 164 base::scoped_nsobject<ReauthenticationModule> reauthenticationModule_;
165
166 base::mac::ObjCPropertyReleaser
167 propertyReleaser_SavePasswordsCollectionViewController_;
168 } 165 }
169 // Kick off async request to get logins from password store. 166 // Kick off async request to get logins from password store.
170 - (void)getLoginsFromPasswordStore; 167 - (void)getLoginsFromPasswordStore;
171 @end 168 @end
172 169
173 @implementation SavePasswordsCollectionViewController 170 @implementation SavePasswordsCollectionViewController
174 171
175 #pragma mark - Initialization 172 #pragma mark - Initialization
176 173
177 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { 174 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState {
178 DCHECK(browserState); 175 DCHECK(browserState);
179 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; 176 self = [super initWithStyle:CollectionViewControllerStyleAppBar];
180 if (self) { 177 if (self) {
181 browserState_ = browserState; 178 browserState_ = browserState;
182 reauthenticationModule_.reset([[ReauthenticationModule alloc] 179 reauthenticationModule_.reset([[ReauthenticationModule alloc]
183 initWithSuccessfulReauthTimeAccessor:self]); 180 initWithSuccessfulReauthTimeAccessor:self]);
184 self.title = l10n_util::GetNSString(IDS_IOS_SAVE_PASSWORDS); 181 self.title = l10n_util::GetNSString(IDS_IOS_SAVE_PASSWORDS);
185 self.shouldHideDoneButton = YES; 182 self.shouldHideDoneButton = YES;
186 passwordStore_ = IOSChromePasswordStoreFactory::GetForBrowserState( 183 passwordStore_ = IOSChromePasswordStoreFactory::GetForBrowserState(
187 browserState_, ServiceAccessType::EXPLICIT_ACCESS); 184 browserState_, ServiceAccessType::EXPLICIT_ACCESS);
188 DCHECK(passwordStore_); 185 DCHECK(passwordStore_);
189 passwordManagerEnabled_.reset([[PrefBackedBoolean alloc] 186 passwordManagerEnabled_.reset([[PrefBackedBoolean alloc]
190 initWithPrefService:browserState_->GetPrefs() 187 initWithPrefService:browserState_->GetPrefs()
191 prefName:password_manager::prefs:: 188 prefName:password_manager::prefs::
192 kPasswordManagerSavingEnabled]); 189 kPasswordManagerSavingEnabled]);
193 [passwordManagerEnabled_ setObserver:self]; 190 [passwordManagerEnabled_ setObserver:self];
194 [self getLoginsFromPasswordStore]; 191 [self getLoginsFromPasswordStore];
195 [self updateEditButton]; 192 [self updateEditButton];
196 [self loadModel]; 193 [self loadModel];
197
198 propertyReleaser_SavePasswordsCollectionViewController_.Init(
199 self, [SavePasswordsCollectionViewController class]);
200 } 194 }
201 return self; 195 return self;
202 } 196 }
203 197
204 - (void)dealloc { 198 - (void)dealloc {
205 [passwordManagerEnabled_ setObserver:nil]; 199 [passwordManagerEnabled_ setObserver:nil];
200 base::mac::ReleaseProperties(self);
206 [super dealloc]; 201 [super dealloc];
207 } 202 }
208 203
209 #pragma mark - SettingsRootCollectionViewController 204 #pragma mark - SettingsRootCollectionViewController
210 205
211 - (void)loadModel { 206 - (void)loadModel {
212 [super loadModel]; 207 [super loadModel];
213 CollectionViewModel* model = self.collectionViewModel; 208 CollectionViewModel* model = self.collectionViewModel;
214 209
215 // Manage account message. 210 // Manage account message.
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 589
595 - (void)updateSuccessfulReauthTime { 590 - (void)updateSuccessfulReauthTime {
596 successfulReauthTime_.reset([[NSDate alloc] init]); 591 successfulReauthTime_.reset([[NSDate alloc] init]);
597 } 592 }
598 593
599 - (NSDate*)lastSuccessfulReauthTime { 594 - (NSDate*)lastSuccessfulReauthTime {
600 return successfulReauthTime_.get(); 595 return successfulReauthTime_.get();
601 } 596 }
602 597
603 @end 598 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698