| 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 17 matching lines...) Expand all Loading... |
| 28 #if !defined(__has_feature) || !__has_feature(objc_arc) | 28 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 29 #error "This file requires ARC support." | 29 #error "This file requires ARC support." |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 typedef NS_ENUM(NSInteger, SectionIdentifier) { | 34 typedef NS_ENUM(NSInteger, SectionIdentifier) { |
| 35 SectionIdentifierSite = kSectionIdentifierEnumZero, | 35 SectionIdentifierSite = kSectionIdentifierEnumZero, |
| 36 SectionIdentifierUsername, | 36 SectionIdentifierUsername, |
| 37 SectionIdentifierPassword, | 37 SectionIdentifierPassword, |
| 38 SectionIdentifierDelete, |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 typedef NS_ENUM(NSInteger, ItemType) { | 41 typedef NS_ENUM(NSInteger, ItemType) { |
| 41 ItemTypeHeader = kItemTypeEnumZero, | 42 ItemTypeHeader = kItemTypeEnumZero, |
| 42 ItemTypeSite, | 43 ItemTypeSite, |
| 43 ItemTypeCopySite, | 44 ItemTypeCopySite, |
| 44 ItemTypeUsername, | 45 ItemTypeUsername, |
| 45 ItemTypeCopyUsername, | 46 ItemTypeCopyUsername, |
| 46 ItemTypePassword, | 47 ItemTypePassword, |
| 47 ItemTypeShowHide, | 48 ItemTypeShowHide, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 _passwordItem.showingText = NO; | 169 _passwordItem.showingText = NO; |
| 169 [model addItem:_passwordItem | 170 [model addItem:_passwordItem |
| 170 toSectionWithIdentifier:SectionIdentifierPassword]; | 171 toSectionWithIdentifier:SectionIdentifierPassword]; |
| 171 | 172 |
| 172 // TODO(crbug.com/159166): Change the style of the buttons once there are | 173 // TODO(crbug.com/159166): Change the style of the buttons once there are |
| 173 // final mocks. | 174 // final mocks. |
| 174 [model addItem:[self showHidePasswordButtonItem] | 175 [model addItem:[self showHidePasswordButtonItem] |
| 175 toSectionWithIdentifier:SectionIdentifierPassword]; | 176 toSectionWithIdentifier:SectionIdentifierPassword]; |
| 176 [model addItem:[self passwordCopyButtonItem] | 177 [model addItem:[self passwordCopyButtonItem] |
| 177 toSectionWithIdentifier:SectionIdentifierPassword]; | 178 toSectionWithIdentifier:SectionIdentifierPassword]; |
| 179 |
| 180 [model addSectionWithIdentifier:SectionIdentifierDelete]; |
| 178 [model addItem:[self deletePasswordButtonItem] | 181 [model addItem:[self deletePasswordButtonItem] |
| 179 toSectionWithIdentifier:SectionIdentifierPassword]; | 182 toSectionWithIdentifier:SectionIdentifierDelete]; |
| 180 } | 183 } |
| 181 | 184 |
| 182 - (void)dealloc { | 185 - (void)dealloc { |
| 183 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 186 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 184 } | 187 } |
| 185 | 188 |
| 186 #pragma mark - Items | 189 #pragma mark - Items |
| 187 | 190 |
| 188 - (CollectionViewItem*)siteCopyButtonItem { | 191 - (CollectionViewItem*)siteCopyButtonItem { |
| 189 CollectionViewTextItem* item = | 192 CollectionViewTextItem* item = |
| (...skipping 244 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 |