| OLD | NEW |
| 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/password_details_collection_view_control
ler.h" | 5 #import "ios/chrome/browser/ui/settings/password_details_collection_view_control
ler.h" |
| 6 | 6 |
| 7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
| 10 #include "components/password_manager/core/browser/affiliation_utils.h" | 10 #include "components/password_manager/core/browser/affiliation_utils.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; | 90 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; |
| 91 if (self) { | 91 if (self) { |
| 92 _weakDelegate = delegate; | 92 _weakDelegate = delegate; |
| 93 _weakReauthenticationModule = reauthenticationModule; | 93 _weakReauthenticationModule = reauthenticationModule; |
| 94 _passwordForm = passwordForm; | 94 _passwordForm = passwordForm; |
| 95 _username = [username copy]; | 95 _username = [username copy]; |
| 96 _password = [password copy]; | 96 _password = [password copy]; |
| 97 _site = base::SysUTF8ToNSString(_passwordForm.origin.spec()); | 97 _site = base::SysUTF8ToNSString(_passwordForm.origin.spec()); |
| 98 self.title = | 98 self.title = |
| 99 [PasswordDetailsCollectionViewController simplifyOrigin:origin]; | 99 [PasswordDetailsCollectionViewController simplifyOrigin:origin]; |
| 100 self.collectionViewAccessibilityIdentifier = |
| 101 @"PasswordDetailsCollectionViewController"; |
| 100 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; | 102 NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter]; |
| 101 [defaultCenter addObserver:self | 103 [defaultCenter addObserver:self |
| 102 selector:@selector(hidePassword) | 104 selector:@selector(hidePassword) |
| 103 name:UIApplicationDidEnterBackgroundNotification | 105 name:UIApplicationDidEnterBackgroundNotification |
| 104 object:nil]; | 106 object:nil]; |
| 105 | 107 |
| 106 [self loadModel]; | 108 [self loadModel]; |
| 107 } | 109 } |
| 108 return self; | 110 return self; |
| 109 } | 111 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_REAUTH_REASON_COPY) | 372 l10n_util::GetNSString(IDS_IOS_SETTINGS_PASSWORD_REAUTH_REASON_COPY) |
| 371 handler:copyPasswordHandler]; | 373 handler:copyPasswordHandler]; |
| 372 } | 374 } |
| 373 } | 375 } |
| 374 | 376 |
| 375 - (void)showCopyResultToast:(NSString*)message { | 377 - (void)showCopyResultToast:(NSString*)message { |
| 376 // TODO(crbug.com/159166): Route this through some delegate API to be able | 378 // TODO(crbug.com/159166): Route this through some delegate API to be able |
| 377 // to mock it in the unittest, and avoid having an EGTest just for that? | 379 // to mock it in the unittest, and avoid having an EGTest just for that? |
| 378 MDCSnackbarMessage* copyPasswordResultMessage = | 380 MDCSnackbarMessage* copyPasswordResultMessage = |
| 379 [MDCSnackbarMessage messageWithText:message]; | 381 [MDCSnackbarMessage messageWithText:message]; |
| 382 copyPasswordResultMessage.category = @"PasswordsSnackbarCategory"; |
| 380 [MDCSnackbarManager showMessage:copyPasswordResultMessage]; | 383 [MDCSnackbarManager showMessage:copyPasswordResultMessage]; |
| 381 } | 384 } |
| 382 | 385 |
| 383 - (void)deletePassword { | 386 - (void)deletePassword { |
| 384 [_weakDelegate deletePassword:_passwordForm]; | 387 [_weakDelegate deletePassword:_passwordForm]; |
| 385 } | 388 } |
| 386 | 389 |
| 387 #pragma mark - UICollectionViewDelegate | 390 #pragma mark - UICollectionViewDelegate |
| 388 | 391 |
| 389 - (void)collectionView:(UICollectionView*)collectionView | 392 - (void)collectionView:(UICollectionView*)collectionView |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 437 } |
| 435 | 438 |
| 436 #pragma mark - ForTesting | 439 #pragma mark - ForTesting |
| 437 | 440 |
| 438 - (void)setReauthenticationModule: | 441 - (void)setReauthenticationModule: |
| 439 (id<ReauthenticationProtocol>)reauthenticationModule { | 442 (id<ReauthenticationProtocol>)reauthenticationModule { |
| 440 _weakReauthenticationModule = reauthenticationModule; | 443 _weakReauthenticationModule = reauthenticationModule; |
| 441 } | 444 } |
| 442 | 445 |
| 443 @end | 446 @end |
| OLD | NEW |