| 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" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 typedef NS_ENUM(NSInteger, ItemType) { | 103 typedef NS_ENUM(NSInteger, ItemType) { |
| 104 ItemTypeSignInButton = kItemTypeEnumZero, | 104 ItemTypeSignInButton = kItemTypeEnumZero, |
| 105 ItemTypeSigninPromo, | 105 ItemTypeSigninPromo, |
| 106 ItemTypeAccount, | 106 ItemTypeAccount, |
| 107 ItemTypeHeader, | 107 ItemTypeHeader, |
| 108 ItemTypeSearchEngine, | 108 ItemTypeSearchEngine, |
| 109 ItemTypeSavedPasswords, | 109 ItemTypeSavedPasswords, |
| 110 ItemTypeAutofill, | 110 ItemTypeAutofill, |
| 111 ItemTypeNativeApps, | |
| 112 ItemTypeVoiceSearch, | 111 ItemTypeVoiceSearch, |
| 113 ItemTypePrivacy, | 112 ItemTypePrivacy, |
| 114 ItemTypeContentSettings, | 113 ItemTypeContentSettings, |
| 115 ItemTypeBandwidth, | 114 ItemTypeBandwidth, |
| 116 ItemTypeAboutChrome, | 115 ItemTypeAboutChrome, |
| 117 ItemTypeMemoryDebugging, | 116 ItemTypeMemoryDebugging, |
| 118 ItemTypeViewSource, | 117 ItemTypeViewSource, |
| 119 ItemTypeLogJavascript, | 118 ItemTypeLogJavascript, |
| 120 ItemTypeShowAutofillTypePredictions, | 119 ItemTypeShowAutofillTypePredictions, |
| 121 ItemTypeCellCatalog, | 120 ItemTypeCellCatalog, |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 basicsHeader.text = l10n_util::GetNSString(IDS_IOS_OPTIONS_GENERAL_TAB_LABEL); | 350 basicsHeader.text = l10n_util::GetNSString(IDS_IOS_OPTIONS_GENERAL_TAB_LABEL); |
| 352 basicsHeader.textColor = [[MDCPalette greyPalette] tint500]; | 351 basicsHeader.textColor = [[MDCPalette greyPalette] tint500]; |
| 353 [model setHeader:basicsHeader | 352 [model setHeader:basicsHeader |
| 354 forSectionWithIdentifier:SectionIdentifierBasics]; | 353 forSectionWithIdentifier:SectionIdentifierBasics]; |
| 355 [model addItem:[self searchEngineDetailItem] | 354 [model addItem:[self searchEngineDetailItem] |
| 356 toSectionWithIdentifier:SectionIdentifierBasics]; | 355 toSectionWithIdentifier:SectionIdentifierBasics]; |
| 357 [model addItem:[self savePasswordsDetailItem] | 356 [model addItem:[self savePasswordsDetailItem] |
| 358 toSectionWithIdentifier:SectionIdentifierBasics]; | 357 toSectionWithIdentifier:SectionIdentifierBasics]; |
| 359 [model addItem:[self autoFillDetailItem] | 358 [model addItem:[self autoFillDetailItem] |
| 360 toSectionWithIdentifier:SectionIdentifierBasics]; | 359 toSectionWithIdentifier:SectionIdentifierBasics]; |
| 361 [model addItem:[self nativeAppsDetailItem] | |
| 362 toSectionWithIdentifier:SectionIdentifierBasics]; | |
| 363 | 360 |
| 364 // Advanced Section | 361 // Advanced Section |
| 365 [model addSectionWithIdentifier:SectionIdentifierAdvanced]; | 362 [model addSectionWithIdentifier:SectionIdentifierAdvanced]; |
| 366 CollectionViewTextItem* advancedHeader = [ | 363 CollectionViewTextItem* advancedHeader = [ |
| 367 [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease]; | 364 [[CollectionViewTextItem alloc] initWithType:ItemTypeHeader] autorelease]; |
| 368 advancedHeader.text = | 365 advancedHeader.text = |
| 369 l10n_util::GetNSString(IDS_IOS_OPTIONS_ADVANCED_TAB_LABEL); | 366 l10n_util::GetNSString(IDS_IOS_OPTIONS_ADVANCED_TAB_LABEL); |
| 370 advancedHeader.textColor = [[MDCPalette greyPalette] tint500]; | 367 advancedHeader.textColor = [[MDCPalette greyPalette] tint500]; |
| 371 [model setHeader:advancedHeader | 368 [model setHeader:advancedHeader |
| 372 forSectionWithIdentifier:SectionIdentifierAdvanced]; | 369 forSectionWithIdentifier:SectionIdentifierAdvanced]; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) | 481 ? l10n_util::GetNSString(IDS_IOS_SETTING_ON) |
| 485 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); | 482 : l10n_util::GetNSString(IDS_IOS_SETTING_OFF); |
| 486 _autoFillDetailItem.reset( | 483 _autoFillDetailItem.reset( |
| 487 [[self detailItemWithType:ItemTypeAutofill | 484 [[self detailItemWithType:ItemTypeAutofill |
| 488 text:l10n_util::GetNSString(IDS_IOS_AUTOFILL) | 485 text:l10n_util::GetNSString(IDS_IOS_AUTOFILL) |
| 489 detailText:autofillDetail] retain]); | 486 detailText:autofillDetail] retain]); |
| 490 | 487 |
| 491 return _autoFillDetailItem; | 488 return _autoFillDetailItem; |
| 492 } | 489 } |
| 493 | 490 |
| 494 - (CollectionViewItem*)nativeAppsDetailItem { | |
| 495 return [self | |
| 496 detailItemWithType:ItemTypeNativeApps | |
| 497 text:l10n_util::GetNSString(IDS_IOS_GOOGLE_APPS_SM_SETTINGS) | |
| 498 detailText:nil]; | |
| 499 } | |
| 500 | |
| 501 - (CollectionViewItem*)voiceSearchDetailItem { | 491 - (CollectionViewItem*)voiceSearchDetailItem { |
| 502 voice::SpeechInputLocaleConfig* localeConfig = | 492 voice::SpeechInputLocaleConfig* localeConfig = |
| 503 voice::SpeechInputLocaleConfig::GetInstance(); | 493 voice::SpeechInputLocaleConfig::GetInstance(); |
| 504 voice::SpeechInputLocale locale = | 494 voice::SpeechInputLocale locale = |
| 505 _voiceLocaleCode.GetValue().length() | 495 _voiceLocaleCode.GetValue().length() |
| 506 ? localeConfig->GetLocaleForCode(_voiceLocaleCode.GetValue()) | 496 ? localeConfig->GetLocaleForCode(_voiceLocaleCode.GetValue()) |
| 507 : localeConfig->GetDefaultLocale(); | 497 : localeConfig->GetDefaultLocale(); |
| 508 NSString* languageName = base::SysUTF16ToNSString(locale.display_name); | 498 NSString* languageName = base::SysUTF16ToNSString(locale.display_name); |
| 509 _voiceSearchDetailItem.reset( | 499 _voiceSearchDetailItem.reset( |
| 510 [[self detailItemWithType:ItemTypeVoiceSearch | 500 [[self detailItemWithType:ItemTypeVoiceSearch |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 break; | 744 break; |
| 755 case ItemTypeSavedPasswords: { | 745 case ItemTypeSavedPasswords: { |
| 756 controller.reset([[SavePasswordsCollectionViewController alloc] | 746 controller.reset([[SavePasswordsCollectionViewController alloc] |
| 757 initWithBrowserState:_mainBrowserState]); | 747 initWithBrowserState:_mainBrowserState]); |
| 758 break; | 748 break; |
| 759 } | 749 } |
| 760 case ItemTypeAutofill: | 750 case ItemTypeAutofill: |
| 761 controller.reset([[AutofillCollectionViewController alloc] | 751 controller.reset([[AutofillCollectionViewController alloc] |
| 762 initWithBrowserState:_mainBrowserState]); | 752 initWithBrowserState:_mainBrowserState]); |
| 763 break; | 753 break; |
| 764 case ItemTypeNativeApps: | |
| 765 controller.reset([[NativeAppsCollectionViewController alloc] | |
| 766 initWithURLRequestContextGetter:_currentBrowserState | |
| 767 ->GetRequestContext()]); | |
| 768 break; | |
| 769 case ItemTypeVoiceSearch: | 754 case ItemTypeVoiceSearch: |
| 770 controller.reset([[VoicesearchCollectionViewController alloc] | 755 controller.reset([[VoicesearchCollectionViewController alloc] |
| 771 initWithPrefs:_mainBrowserState->GetPrefs()]); | 756 initWithPrefs:_mainBrowserState->GetPrefs()]); |
| 772 break; | 757 break; |
| 773 case ItemTypePrivacy: | 758 case ItemTypePrivacy: |
| 774 controller.reset([[PrivacyCollectionViewController alloc] | 759 controller.reset([[PrivacyCollectionViewController alloc] |
| 775 initWithBrowserState:_mainBrowserState]); | 760 initWithBrowserState:_mainBrowserState]); |
| 776 break; | 761 break; |
| 777 case ItemTypeContentSettings: | 762 case ItemTypeContentSettings: |
| 778 controller.reset([[ContentSettingsCollectionViewController alloc] | 763 controller.reset([[ContentSettingsCollectionViewController alloc] |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 if (signinPromoItem) { | 1143 if (signinPromoItem) { |
| 1159 signinPromoItem.configurator = configurator; | 1144 signinPromoItem.configurator = configurator; |
| 1160 [self reconfigureCellsForItems:@[ signinPromoItem ] | 1145 [self reconfigureCellsForItems:@[ signinPromoItem ] |
| 1161 inSectionWithIdentifier:SectionIdentifierSignIn]; | 1146 inSectionWithIdentifier:SectionIdentifierSignIn]; |
| 1162 if (newIdentity) | 1147 if (newIdentity) |
| 1163 [self.collectionViewLayout invalidateLayout]; | 1148 [self.collectionViewLayout invalidateLayout]; |
| 1164 } | 1149 } |
| 1165 } | 1150 } |
| 1166 | 1151 |
| 1167 @end | 1152 @end |
| OLD | NEW |