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/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" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 toSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch]; | 227 toSectionWithIdentifier:SectionIdentifierSavePasswordsSwitch]; |
228 | 228 |
229 // Saved passwords. | 229 // Saved passwords. |
230 if ([passwordManagerEnabled_ value]) { | 230 if ([passwordManagerEnabled_ value]) { |
231 if (!savedForms_.empty()) { | 231 if (!savedForms_.empty()) { |
232 [model addSectionWithIdentifier:SectionIdentifierSavedPasswords]; | 232 [model addSectionWithIdentifier:SectionIdentifierSavedPasswords]; |
233 CollectionViewTextItem* headerItem = [[[CollectionViewTextItem alloc] | 233 CollectionViewTextItem* headerItem = [[[CollectionViewTextItem alloc] |
234 initWithType:ItemTypeHeader] autorelease]; | 234 initWithType:ItemTypeHeader] autorelease]; |
235 headerItem.text = | 235 headerItem.text = |
236 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE); | 236 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_SHOW_PASSWORDS_TAB_TITLE); |
| 237 headerItem.textColor = [[MDCPalette greyPalette] tint500]; |
237 [model setHeader:headerItem | 238 [model setHeader:headerItem |
238 forSectionWithIdentifier:SectionIdentifierSavedPasswords]; | 239 forSectionWithIdentifier:SectionIdentifierSavedPasswords]; |
239 for (const auto& form : savedForms_) { | 240 for (const auto& form : savedForms_) { |
240 [model addItem:[self savedFormItemWithForm:form.get()] | 241 [model addItem:[self savedFormItemWithForm:form.get()] |
241 toSectionWithIdentifier:SectionIdentifierSavedPasswords]; | 242 toSectionWithIdentifier:SectionIdentifierSavedPasswords]; |
242 } | 243 } |
243 } | 244 } |
244 if (!blacklistedForms_.empty()) { | 245 if (!blacklistedForms_.empty()) { |
245 [model addSectionWithIdentifier:SectionIdentifierBlacklist]; | 246 [model addSectionWithIdentifier:SectionIdentifierBlacklist]; |
246 CollectionViewTextItem* headerItem = [[[CollectionViewTextItem alloc] | 247 CollectionViewTextItem* headerItem = [[[CollectionViewTextItem alloc] |
247 initWithType:ItemTypeHeader] autorelease]; | 248 initWithType:ItemTypeHeader] autorelease]; |
248 headerItem.text = | 249 headerItem.text = |
249 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_EXCEPTIONS_TAB_TITLE); | 250 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_EXCEPTIONS_TAB_TITLE); |
| 251 headerItem.textColor = [[MDCPalette greyPalette] tint500]; |
250 [model setHeader:headerItem | 252 [model setHeader:headerItem |
251 forSectionWithIdentifier:SectionIdentifierBlacklist]; | 253 forSectionWithIdentifier:SectionIdentifierBlacklist]; |
252 for (const auto& form : blacklistedForms_) { | 254 for (const auto& form : blacklistedForms_) { |
253 [model addItem:[self blacklistedFormItemWithForm:form.get()] | 255 [model addItem:[self blacklistedFormItemWithForm:form.get()] |
254 toSectionWithIdentifier:SectionIdentifierBlacklist]; | 256 toSectionWithIdentifier:SectionIdentifierBlacklist]; |
255 } | 257 } |
256 } | 258 } |
257 } | 259 } |
258 } | 260 } |
259 | 261 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 ItemTypeSavePasswordsSwitch) { | 379 ItemTypeSavePasswordsSwitch) { |
378 CollectionViewSwitchCell* switchCell = | 380 CollectionViewSwitchCell* switchCell = |
379 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); | 381 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); |
380 [switchCell.switchView addTarget:self | 382 [switchCell.switchView addTarget:self |
381 action:@selector(savePasswordsSwitchChanged:) | 383 action:@selector(savePasswordsSwitchChanged:) |
382 forControlEvents:UIControlEventValueChanged]; | 384 forControlEvents:UIControlEventValueChanged]; |
383 } | 385 } |
384 return cell; | 386 return cell; |
385 } | 387 } |
386 | 388 |
387 - (UICollectionReusableView*)collectionView:(UICollectionView*)collectionView | |
388 viewForSupplementaryElementOfKind:(NSString*)kind | |
389 atIndexPath:(NSIndexPath*)indexPath { | |
390 UICollectionReusableView* view = [super collectionView:collectionView | |
391 viewForSupplementaryElementOfKind:kind | |
392 atIndexPath:indexPath]; | |
393 MDCCollectionViewTextCell* textCell = | |
394 base::mac::ObjCCast<MDCCollectionViewTextCell>(view); | |
395 if (textCell) { | |
396 textCell.textLabel.textColor = [[MDCPalette greyPalette] tint500]; | |
397 } | |
398 return view; | |
399 }; | |
400 | |
401 #pragma mark - BooleanObserver | 389 #pragma mark - BooleanObserver |
402 | 390 |
403 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { | 391 - (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean { |
404 DCHECK_EQ(observableBoolean, passwordManagerEnabled_.get()); | 392 DCHECK_EQ(observableBoolean, passwordManagerEnabled_.get()); |
405 | 393 |
406 // Update the item. | 394 // Update the item. |
407 savePasswordsItem_.get().on = [passwordManagerEnabled_ value]; | 395 savePasswordsItem_.get().on = [passwordManagerEnabled_ value]; |
408 | 396 |
409 // Update the cell. | 397 // Update the cell. |
410 [self reconfigureCellsForItems:@[ savePasswordsItem_ ] | 398 [self reconfigureCellsForItems:@[ savePasswordsItem_ ] |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 | 595 |
608 - (void)updateSuccessfulReauthTime { | 596 - (void)updateSuccessfulReauthTime { |
609 successfulReauthTime_.reset([[NSDate alloc] init]); | 597 successfulReauthTime_.reset([[NSDate alloc] init]); |
610 } | 598 } |
611 | 599 |
612 - (NSDate*)lastSuccessfulReauthTime { | 600 - (NSDate*)lastSuccessfulReauthTime { |
613 return successfulReauthTime_.get(); | 601 return successfulReauthTime_.get(); |
614 } | 602 } |
615 | 603 |
616 @end | 604 @end |
OLD | NEW |