| 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 | 8 |
| 9 #include "base/ios/ios_util.h" | 9 #include "base/ios/ios_util.h" |
| 10 #include "base/ios/weak_nsobject.h" | 10 #include "base/ios/weak_nsobject.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/mac/foundation_util.h" | 12 #include "base/mac/foundation_util.h" |
| 13 #include "base/mac/objc_property_releaser.h" | 13 #include "base/mac/objc_property_releaser.h" |
| 14 #include "base/mac/scoped_nsobject.h" | 14 #include "base/mac/scoped_nsobject.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/numerics/safe_conversions.h" | 16 #include "base/numerics/safe_conversions.h" |
| 17 #include "base/strings/sys_string_conversions.h" | 17 #include "base/strings/sys_string_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "components/autofill/core/common/password_form.h" | 19 #include "components/autofill/core/common/password_form.h" |
| 20 #include "components/browser_sync/profile_sync_service.h" | |
| 21 #include "components/google/core/browser/google_util.h" | 20 #include "components/google/core/browser/google_util.h" |
| 22 #include "components/keyed_service/core/service_access_type.h" | 21 #include "components/keyed_service/core/service_access_type.h" |
| 23 #include "components/password_manager/core/browser/affiliation_utils.h" | 22 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 24 #include "components/password_manager/core/browser/password_bubble_experiment.h" | |
| 25 #include "components/password_manager/core/browser/password_manager_constants.h" | 23 #include "components/password_manager/core/browser/password_manager_constants.h" |
| 26 #include "components/password_manager/core/browser/password_store.h" | 24 #include "components/password_manager/core/browser/password_store.h" |
| 27 #include "components/password_manager/core/browser/password_store_consumer.h" | 25 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 28 #include "components/password_manager/core/common/password_manager_pref_names.h" | 26 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 29 #include "components/prefs/pref_member.h" | 27 #include "components/prefs/pref_member.h" |
| 30 #include "components/prefs/pref_service.h" | 28 #include "components/prefs/pref_service.h" |
| 31 #include "components/strings/grit/components_strings.h" | 29 #include "components/strings/grit/components_strings.h" |
| 32 #include "components/url_formatter/url_formatter.h" | 30 #include "components/url_formatter/url_formatter.h" |
| 33 #include "ios/chrome/browser/application_context.h" | 31 #include "ios/chrome/browser/application_context.h" |
| 34 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 32 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 35 #include "ios/chrome/browser/experimental_flags.h" | 33 #include "ios/chrome/browser/experimental_flags.h" |
| 36 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" | 34 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" |
| 37 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h" | |
| 38 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" | 35 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom
e.h" |
| 39 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" | 36 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item
.h" |
| 40 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" | 37 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 41 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item
.h" | 38 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item
.h" |
| 42 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" | 39 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h
" |
| 43 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" | 40 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" |
| 44 #import "ios/chrome/browser/ui/settings/password_details_collection_view_control
ler.h" | 41 #import "ios/chrome/browser/ui/settings/password_details_collection_view_control
ler.h" |
| 45 #import "ios/chrome/browser/ui/settings/reauthentication_module.h" | 42 #import "ios/chrome/browser/ui/settings/reauthentication_module.h" |
| 46 #import "ios/chrome/browser/ui/settings/settings_utils.h" | 43 #import "ios/chrome/browser/ui/settings/settings_utils.h" |
| 47 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" | 44 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 173 |
| 177 #pragma mark - Initialization | 174 #pragma mark - Initialization |
| 178 | 175 |
| 179 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { | 176 - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { |
| 180 DCHECK(browserState); | 177 DCHECK(browserState); |
| 181 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; | 178 self = [super initWithStyle:CollectionViewControllerStyleAppBar]; |
| 182 if (self) { | 179 if (self) { |
| 183 browserState_ = browserState; | 180 browserState_ = browserState; |
| 184 reauthenticationModule_.reset([[ReauthenticationModule alloc] | 181 reauthenticationModule_.reset([[ReauthenticationModule alloc] |
| 185 initWithSuccessfulReauthTimeAccessor:self]); | 182 initWithSuccessfulReauthTimeAccessor:self]); |
| 186 int titleId = IDS_IOS_SAVE_PASSWORDS; | 183 self.title = l10n_util::GetNSString(IDS_IOS_SAVE_PASSWORDS); |
| 187 syncer::SyncService* syncService = | |
| 188 IOSChromeProfileSyncServiceFactory::GetForBrowserState(browserState_); | |
| 189 if (password_bubble_experiment::IsSmartLockBrandingEnabled(syncService)) { | |
| 190 titleId = IDS_IOS_SAVE_PASSWORDS_SMART_LOCK; | |
| 191 } | |
| 192 self.title = l10n_util::GetNSString(titleId); | |
| 193 self.shouldHideDoneButton = YES; | 184 self.shouldHideDoneButton = YES; |
| 194 passwordStore_ = IOSChromePasswordStoreFactory::GetForBrowserState( | 185 passwordStore_ = IOSChromePasswordStoreFactory::GetForBrowserState( |
| 195 browserState_, ServiceAccessType::EXPLICIT_ACCESS); | 186 browserState_, ServiceAccessType::EXPLICIT_ACCESS); |
| 196 DCHECK(passwordStore_); | 187 DCHECK(passwordStore_); |
| 197 passwordManagerEnabled_.reset([[PrefBackedBoolean alloc] | 188 passwordManagerEnabled_.reset([[PrefBackedBoolean alloc] |
| 198 initWithPrefService:browserState_->GetPrefs() | 189 initWithPrefService:browserState_->GetPrefs() |
| 199 prefName:password_manager::prefs:: | 190 prefName:password_manager::prefs:: |
| 200 kPasswordManagerSavingEnabled]); | 191 kPasswordManagerSavingEnabled]); |
| 201 [passwordManagerEnabled_ setObserver:self]; | 192 [passwordManagerEnabled_ setObserver:self]; |
| 202 [self getLoginsFromPasswordStore]; | 193 [self getLoginsFromPasswordStore]; |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 608 |
| 618 - (void)updateSuccessfulReauthTime { | 609 - (void)updateSuccessfulReauthTime { |
| 619 successfulReauthTime_.reset([[NSDate alloc] init]); | 610 successfulReauthTime_.reset([[NSDate alloc] init]); |
| 620 } | 611 } |
| 621 | 612 |
| 622 - (NSDate*)lastSuccessfulReauthTime { | 613 - (NSDate*)lastSuccessfulReauthTime { |
| 623 return successfulReauthTime_.get(); | 614 return successfulReauthTime_.get(); |
| 624 } | 615 } |
| 625 | 616 |
| 626 @end | 617 @end |
| OLD | NEW |