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