| 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/privacy_collection_view_controller.h" | 5 #import "ios/chrome/browser/ui/settings/privacy_collection_view_controller.h" |
| 6 | 6 |
| 7 #include "base/ios/ios_util.h" | 7 #include "base/ios/ios_util.h" |
| 8 #import "base/ios/weak_nsobject.h" | 8 #import "base/ios/weak_nsobject.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 [super loadModel]; | 158 [super loadModel]; |
| 159 | 159 |
| 160 CollectionViewModel* model = self.collectionViewModel; | 160 CollectionViewModel* model = self.collectionViewModel; |
| 161 | 161 |
| 162 // Other Devices Section | 162 // Other Devices Section |
| 163 [model addSectionWithIdentifier:SectionIdentifierOtherDevices]; | 163 [model addSectionWithIdentifier:SectionIdentifierOtherDevices]; |
| 164 CollectionViewTextItem* otherDevicesHeader = [[[CollectionViewTextItem alloc] | 164 CollectionViewTextItem* otherDevicesHeader = [[[CollectionViewTextItem alloc] |
| 165 initWithType:ItemTypeOtherDevicesHeader] autorelease]; | 165 initWithType:ItemTypeOtherDevicesHeader] autorelease]; |
| 166 otherDevicesHeader.text = | 166 otherDevicesHeader.text = |
| 167 l10n_util::GetNSString(IDS_IOS_OPTIONS_CONTINUITY_LABEL); | 167 l10n_util::GetNSString(IDS_IOS_OPTIONS_CONTINUITY_LABEL); |
| 168 otherDevicesHeader.textColor = [[MDCPalette greyPalette] tint500]; |
| 168 [model setHeader:otherDevicesHeader | 169 [model setHeader:otherDevicesHeader |
| 169 forSectionWithIdentifier:SectionIdentifierOtherDevices]; | 170 forSectionWithIdentifier:SectionIdentifierOtherDevices]; |
| 170 [model addItem:[self handoffDetailItem] | 171 [model addItem:[self handoffDetailItem] |
| 171 toSectionWithIdentifier:SectionIdentifierOtherDevices]; | 172 toSectionWithIdentifier:SectionIdentifierOtherDevices]; |
| 172 | 173 |
| 173 // Web Services Section | 174 // Web Services Section |
| 174 [model addSectionWithIdentifier:SectionIdentifierWebServices]; | 175 [model addSectionWithIdentifier:SectionIdentifierWebServices]; |
| 175 CollectionViewTextItem* webServicesHeader = [[[CollectionViewTextItem alloc] | 176 CollectionViewTextItem* webServicesHeader = [[[CollectionViewTextItem alloc] |
| 176 initWithType:ItemTypeWebServicesHeader] autorelease]; | 177 initWithType:ItemTypeWebServicesHeader] autorelease]; |
| 177 webServicesHeader.text = | 178 webServicesHeader.text = |
| 178 l10n_util::GetNSString(IDS_IOS_OPTIONS_WEB_SERVICES_LABEL); | 179 l10n_util::GetNSString(IDS_IOS_OPTIONS_WEB_SERVICES_LABEL); |
| 180 webServicesHeader.textColor = [[MDCPalette greyPalette] tint500]; |
| 179 [model setHeader:webServicesHeader | 181 [model setHeader:webServicesHeader |
| 180 forSectionWithIdentifier:SectionIdentifierWebServices]; | 182 forSectionWithIdentifier:SectionIdentifierWebServices]; |
| 181 _showSuggestionsItem.reset([[self showSuggestionsSwitchItem] retain]); | 183 _showSuggestionsItem.reset([[self showSuggestionsSwitchItem] retain]); |
| 182 [model addItem:_showSuggestionsItem | 184 [model addItem:_showSuggestionsItem |
| 183 toSectionWithIdentifier:SectionIdentifierWebServices]; | 185 toSectionWithIdentifier:SectionIdentifierWebServices]; |
| 184 | 186 |
| 185 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { | 187 if ([TouchToSearchPermissionsMediator isTouchToSearchAvailableOnDevice]) { |
| 186 [model addItem:[self contextualSearchDetailItem] | 188 [model addItem:[self contextualSearchDetailItem] |
| 187 toSectionWithIdentifier:SectionIdentifierWebServices]; | 189 toSectionWithIdentifier:SectionIdentifierWebServices]; |
| 188 } | 190 } |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 CollectionViewSwitchCell* switchCell = | 333 CollectionViewSwitchCell* switchCell = |
| 332 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); | 334 base::mac::ObjCCastStrict<CollectionViewSwitchCell>(cell); |
| 333 [switchCell.switchView addTarget:self | 335 [switchCell.switchView addTarget:self |
| 334 action:@selector(showSuggestionsToggled:) | 336 action:@selector(showSuggestionsToggled:) |
| 335 forControlEvents:UIControlEventValueChanged]; | 337 forControlEvents:UIControlEventValueChanged]; |
| 336 } | 338 } |
| 337 | 339 |
| 338 return cell; | 340 return cell; |
| 339 } | 341 } |
| 340 | 342 |
| 341 - (UICollectionReusableView*)collectionView:(UICollectionView*)collectionView | |
| 342 viewForSupplementaryElementOfKind:(NSString*)kind | |
| 343 atIndexPath:(NSIndexPath*)indexPath { | |
| 344 UICollectionReusableView* view = [super collectionView:collectionView | |
| 345 viewForSupplementaryElementOfKind:kind | |
| 346 atIndexPath:indexPath]; | |
| 347 | |
| 348 MDCCollectionViewTextCell* textCell = | |
| 349 base::mac::ObjCCast<MDCCollectionViewTextCell>(view); | |
| 350 if (textCell) { | |
| 351 textCell.textLabel.textColor = [[MDCPalette greyPalette] tint500]; | |
| 352 } | |
| 353 return view; | |
| 354 } | |
| 355 | |
| 356 #pragma mark UICollectionViewDelegate | 343 #pragma mark UICollectionViewDelegate |
| 357 - (void)collectionView:(UICollectionView*)collectionView | 344 - (void)collectionView:(UICollectionView*)collectionView |
| 358 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { | 345 didSelectItemAtIndexPath:(NSIndexPath*)indexPath { |
| 359 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; | 346 [super collectionView:collectionView didSelectItemAtIndexPath:indexPath]; |
| 360 NSInteger itemType = | 347 NSInteger itemType = |
| 361 [self.collectionViewModel itemTypeForIndexPath:indexPath]; | 348 [self.collectionViewModel itemTypeForIndexPath:indexPath]; |
| 362 | 349 |
| 363 // Items that push a new view controller. | 350 // Items that push a new view controller. |
| 364 base::scoped_nsobject<UIViewController> controller; | 351 base::scoped_nsobject<UIViewController> controller; |
| 365 | 352 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 494 |
| 508 _sendUsageDetailItem.get().detailText = detailText; | 495 _sendUsageDetailItem.get().detailText = detailText; |
| 509 | 496 |
| 510 [self reconfigureCellsForItems:@[ _sendUsageDetailItem ] | 497 [self reconfigureCellsForItems:@[ _sendUsageDetailItem ] |
| 511 inSectionWithIdentifier:SectionIdentifierWebServices]; | 498 inSectionWithIdentifier:SectionIdentifierWebServices]; |
| 512 return; | 499 return; |
| 513 } | 500 } |
| 514 } | 501 } |
| 515 | 502 |
| 516 @end | 503 @end |
| OLD | NEW |