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/settings_collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/settings_collection_view_controller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
11 #import "base/mac/scoped_nsobject.h" | 11 #import "base/mac/scoped_nsobject.h" |
12 #include "base/metrics/user_metrics.h" | 12 #include "base/metrics/user_metrics.h" |
13 #include "base/scoped_observer.h" | 13 #include "base/scoped_observer.h" |
14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
15 #include "components/autofill/core/common/autofill_pref_names.h" | 15 #include "components/autofill/core/common/autofill_pref_names.h" |
16 #include "components/browser_sync/profile_sync_service.h" | 16 #include "components/browser_sync/profile_sync_service.h" |
17 #include "components/keyed_service/core/service_access_type.h" | 17 #include "components/keyed_service/core/service_access_type.h" |
18 #include "components/password_manager/core/browser/password_bubble_experiment.h" | |
19 #include "components/password_manager/core/browser/password_store.h" | 18 #include "components/password_manager/core/browser/password_store.h" |
20 #include "components/password_manager/core/common/password_manager_pref_names.h" | 19 #include "components/password_manager/core/common/password_manager_pref_names.h" |
21 #include "components/prefs/pref_change_registrar.h" | 20 #include "components/prefs/pref_change_registrar.h" |
22 #include "components/prefs/pref_service.h" | 21 #include "components/prefs/pref_service.h" |
23 #include "components/search_engines/util.h" | 22 #include "components/search_engines/util.h" |
24 #include "components/signin/core/browser/signin_manager.h" | 23 #include "components/signin/core/browser/signin_manager.h" |
25 #include "components/signin/core/common/signin_pref_names.h" | 24 #include "components/signin/core/common/signin_pref_names.h" |
26 #include "components/strings/grit/components_strings.h" | 25 #include "components/strings/grit/components_strings.h" |
27 #include "ios/chrome/browser/application_context.h" | 26 #include "ios/chrome/browser/application_context.h" |
28 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" | 27 #import "ios/chrome/browser/browser_state/chrome_browser_state.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 kSettingsSearchEngineCellId; | 434 kSettingsSearchEngineCellId; |
436 return _defaultSearchEngineItem; | 435 return _defaultSearchEngineItem; |
437 } | 436 } |
438 | 437 |
439 - (CollectionViewItem*)savePasswordsDetailItem { | 438 - (CollectionViewItem*)savePasswordsDetailItem { |
440 BOOL savePasswordsEnabled = _mainBrowserState->GetPrefs()->GetBoolean( | 439 BOOL savePasswordsEnabled = _mainBrowserState->GetPrefs()->GetBoolean( |
441 password_manager::prefs::kPasswordManagerSavingEnabled); | 440 password_manager::prefs::kPasswordManagerSavingEnabled); |
442 NSString* passwordsDetail = savePasswordsEnabled | 441 NSString* passwordsDetail = savePasswordsEnabled |
443 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 442 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
444 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 443 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
445 int titleId = IDS_IOS_SAVE_PASSWORDS; | |
446 syncer::SyncService* syncService = | |
447 IOSChromeProfileSyncServiceFactory::GetForBrowserState(_mainBrowserState); | |
448 if (password_bubble_experiment::IsSmartLockBrandingEnabled(syncService)) { | |
449 titleId = IDS_IOS_SAVE_PASSWORDS_SMART_LOCK; | |
450 } | |
451 | 444 |
452 _savePasswordsDetailItem.reset( | 445 _savePasswordsDetailItem.reset( |
453 [[self detailItemWithType:ItemTypeSavedPasswords | 446 [[self detailItemWithType:ItemTypeSavedPasswords |
454 text:l10n_util::GetNSString(titleId) | 447 text:l10n_util::GetNSString(IDS_IOS_SAVE_PASSWORDS) |
455 detailText:passwordsDetail] retain]); | 448 detailText:passwordsDetail] retain]); |
456 | 449 |
457 return _savePasswordsDetailItem; | 450 return _savePasswordsDetailItem; |
458 } | 451 } |
459 | 452 |
460 - (CollectionViewItem*)autoFillDetailItem { | 453 - (CollectionViewItem*)autoFillDetailItem { |
461 BOOL autofillEnabled = _mainBrowserState->GetPrefs()->GetBoolean( | 454 BOOL autofillEnabled = _mainBrowserState->GetPrefs()->GetBoolean( |
462 autofill::prefs::kAutofillEnabled); | 455 autofill::prefs::kAutofillEnabled); |
463 NSString* autofillDetail = autofillEnabled | 456 NSString* autofillDetail = autofillEnabled |
464 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 457 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 NSString* autofillDetail = | 1080 NSString* autofillDetail = |
1088 autofillEnabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 1081 autofillEnabled ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
1089 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 1082 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
1090 _autoFillDetailItem.get().detailText = autofillDetail; | 1083 _autoFillDetailItem.get().detailText = autofillDetail; |
1091 [self reconfigureCellsForItems:@[ _autoFillDetailItem ] | 1084 [self reconfigureCellsForItems:@[ _autoFillDetailItem ] |
1092 inSectionWithIdentifier:SectionIdentifierBasics]; | 1085 inSectionWithIdentifier:SectionIdentifierBasics]; |
1093 } | 1086 } |
1094 } | 1087 } |
1095 | 1088 |
1096 @end | 1089 @end |
OLD | NEW |