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/clear_browsing_data_collection_view_cont
roller.h" | 5 #import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_cont
roller.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 return; | 403 return; |
404 } | 404 } |
405 ClearDataItem* clearDataItem = base::mac::ObjCCastStrict<ClearDataItem>( | 405 ClearDataItem* clearDataItem = base::mac::ObjCCastStrict<ClearDataItem>( |
406 [model itemAtIndexPath:indexPath]); | 406 [model itemAtIndexPath:indexPath]); |
407 // Because there is no counter for cookies, an explanatory text is displayed. | 407 // Because there is no counter for cookies, an explanatory text is displayed. |
408 if (![clearDataItem hasCounter] && | 408 if (![clearDataItem hasCounter] && |
409 itemType != ItemTypeDataTypeCookiesSiteData) { | 409 itemType != ItemTypeDataTypeCookiesSiteData) { |
410 return; | 410 return; |
411 } | 411 } |
412 clearDataItem.detailText = detailText; | 412 clearDataItem.detailText = detailText; |
413 [self reconfigureCellsForItems:@[ clearDataItem ] | 413 [self reconfigureCellsForItems:@[ clearDataItem ]]; |
414 inSectionWithIdentifier:SectionIdentifierDataTypes]; | |
415 [self.collectionView.collectionViewLayout invalidateLayout]; | 414 [self.collectionView.collectionViewLayout invalidateLayout]; |
416 } | 415 } |
417 | 416 |
418 - (CollectionViewItem*)footerForGoogleAccountSectionItem { | 417 - (CollectionViewItem*)footerForGoogleAccountSectionItem { |
419 return _shouldShowNoticeAboutOtherFormsOfBrowsingHistory | 418 return _shouldShowNoticeAboutOtherFormsOfBrowsingHistory |
420 ? [self footerGoogleAccountAndMyActivityItem] | 419 ? [self footerGoogleAccountAndMyActivityItem] |
421 : [self footerGoogleAccountItem]; | 420 : [self footerGoogleAccountItem]; |
422 } | 421 } |
423 | 422 |
424 - (CollectionViewItem*)footerGoogleAccountItem { | 423 - (CollectionViewItem*)footerGoogleAccountItem { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 529 } |
531 _browserState->GetPrefs()->SetBoolean(clearDataItem.prefName, true); | 530 _browserState->GetPrefs()->SetBoolean(clearDataItem.prefName, true); |
532 } else { | 531 } else { |
533 clearDataItem.accessoryType = MDCCollectionViewCellAccessoryNone; | 532 clearDataItem.accessoryType = MDCCollectionViewCellAccessoryNone; |
534 _browserState->GetPrefs()->SetBoolean(clearDataItem.prefName, false); | 533 _browserState->GetPrefs()->SetBoolean(clearDataItem.prefName, false); |
535 if (experimental_flags::IsNewClearBrowsingDataUIEnabled()) { | 534 if (experimental_flags::IsNewClearBrowsingDataUIEnabled()) { |
536 // Hide counter text. | 535 // Hide counter text. |
537 [self updateCounter:itemType detailText:nil]; | 536 [self updateCounter:itemType detailText:nil]; |
538 } | 537 } |
539 } | 538 } |
540 [self reconfigureCellsForItems:@[ clearDataItem ] | 539 [self reconfigureCellsForItems:@[ clearDataItem ]]; |
541 inSectionWithIdentifier:SectionIdentifierDataTypes]; | |
542 break; | 540 break; |
543 } | 541 } |
544 case ItemTypeClearBrowsingDataButton: | 542 case ItemTypeClearBrowsingDataButton: |
545 [self alertAndClearData]; | 543 [self alertAndClearData]; |
546 break; | 544 break; |
547 default: | 545 default: |
548 break; | 546 break; |
549 } | 547 } |
550 } | 548 } |
551 | 549 |
(...skipping 26 matching lines...) Expand all Loading... |
578 [model removeItemWithType:ItemTypeFooterGoogleAccount | 576 [model removeItemWithType:ItemTypeFooterGoogleAccount |
579 fromSectionWithIdentifier:SectionIdentifierGoogleAccount]; | 577 fromSectionWithIdentifier:SectionIdentifierGoogleAccount]; |
580 } else { | 578 } else { |
581 [model removeItemWithType:ItemTypeFooterGoogleAccountAndMyActivity | 579 [model removeItemWithType:ItemTypeFooterGoogleAccountAndMyActivity |
582 fromSectionWithIdentifier:SectionIdentifierGoogleAccount]; | 580 fromSectionWithIdentifier:SectionIdentifierGoogleAccount]; |
583 } | 581 } |
584 } | 582 } |
585 // Add the new footer. | 583 // Add the new footer. |
586 [model addItem:footerItem | 584 [model addItem:footerItem |
587 toSectionWithIdentifier:SectionIdentifierGoogleAccount]; | 585 toSectionWithIdentifier:SectionIdentifierGoogleAccount]; |
588 [self reconfigureCellsForItems:@[ footerItem ] | 586 [self reconfigureCellsForItems:@[ footerItem ]]; |
589 inSectionWithIdentifier:SectionIdentifierGoogleAccount]; | |
590 | 587 |
591 // Relayout the cells to adapt to the new contents height. | 588 // Relayout the cells to adapt to the new contents height. |
592 [self.collectionView.collectionViewLayout invalidateLayout]; | 589 [self.collectionView.collectionViewLayout invalidateLayout]; |
593 } | 590 } |
594 | 591 |
595 #pragma mark Clear browsing data | 592 #pragma mark Clear browsing data |
596 | 593 |
597 - (BOOL)alertAndClearData { | 594 - (BOOL)alertAndClearData { |
598 int dataTypeMaskToRemove = 0; | 595 int dataTypeMaskToRemove = 0; |
599 NSArray* dataTypeItems = [self.collectionViewModel | 596 NSArray* dataTypeItems = [self.collectionViewModel |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 871 |
875 #pragma mark TimeRangeSelectorCollectionViewControllerDelegate | 872 #pragma mark TimeRangeSelectorCollectionViewControllerDelegate |
876 | 873 |
877 - (void)timeRangeSelectorViewController: | 874 - (void)timeRangeSelectorViewController: |
878 (TimeRangeSelectorCollectionViewController*)collectionViewController | 875 (TimeRangeSelectorCollectionViewController*)collectionViewController |
879 didSelectTimePeriod:(browsing_data::TimePeriod)timePeriod { | 876 didSelectTimePeriod:(browsing_data::TimePeriod)timePeriod { |
880 _timePeriod = timePeriod; | 877 _timePeriod = timePeriod; |
881 } | 878 } |
882 | 879 |
883 @end | 880 @end |
OLD | NEW |