Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: ios/chrome/browser/ui/history/history_collection_view_controller.mm

Issue 2817953002: CollectionViewTextItem no longer styles CollectionViewTextCell (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "ios/chrome/browser/ui/history/history_collection_view_controller.h" 5 #include "ios/chrome/browser/ui/history/history_collection_view_controller.h"
6 6
7 #import <MobileCoreServices/MobileCoreServices.h> 7 #import <MobileCoreServices/MobileCoreServices.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
13 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
14 #include "base/strings/sys_string_conversions.h" 14 #include "base/strings/sys_string_conversions.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "components/browsing_data/core/history_notice_utils.h" 16 #include "components/browsing_data/core/history_notice_utils.h"
17 #include "components/strings/grit/components_strings.h" 17 #include "components/strings/grit/components_strings.h"
18 #include "components/url_formatter/url_formatter.h" 18 #include "components/url_formatter/url_formatter.h"
19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 19 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
20 #include "ios/chrome/browser/chrome_url_constants.h" 20 #include "ios/chrome/browser/chrome_url_constants.h"
21 #import "ios/chrome/browser/signin/authentication_service.h" 21 #import "ios/chrome/browser/signin/authentication_service.h"
22 #include "ios/chrome/browser/signin/authentication_service_factory.h" 22 #include "ios/chrome/browser/signin/authentication_service_factory.h"
23 #include "ios/chrome/browser/sync/sync_setup_service.h" 23 #include "ios/chrome/browser/sync/sync_setup_service.h"
24 #include "ios/chrome/browser/sync/sync_setup_service_factory.h" 24 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
25 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h" 25 #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrom e.h"
26 #import "ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell.h" 26 #import "ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell.h"
27 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" 27 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
28 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_cell.h "
28 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h " 29 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h "
29 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h" 30 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
30 #import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h" 31 #import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h"
31 #include "ios/chrome/browser/ui/history/history_entries_status_item.h" 32 #include "ios/chrome/browser/ui/history/history_entries_status_item.h"
32 #include "ios/chrome/browser/ui/history/history_entry.h" 33 #include "ios/chrome/browser/ui/history/history_entry.h"
33 #include "ios/chrome/browser/ui/history/history_entry_inserter.h" 34 #include "ios/chrome/browser/ui/history/history_entry_inserter.h"
34 #import "ios/chrome/browser/ui/history/history_entry_item.h" 35 #import "ios/chrome/browser/ui/history/history_entry_item.h"
35 #include "ios/chrome/browser/ui/history/history_service_facade.h" 36 #include "ios/chrome/browser/ui/history/history_service_facade.h"
36 #include "ios/chrome/browser/ui/history/history_service_facade_delegate.h" 37 #include "ios/chrome/browser/ui/history/history_service_facade_delegate.h"
37 #include "ios/chrome/browser/ui/history/history_util.h" 38 #include "ios/chrome/browser/ui/history/history_util.h"
38 #import "ios/chrome/browser/ui/url_loader.h" 39 #import "ios/chrome/browser/ui/url_loader.h"
39 #import "ios/chrome/browser/ui/util/pasteboard_util.h" 40 #import "ios/chrome/browser/ui/util/pasteboard_util.h"
40 #include "ios/chrome/grit/ios_strings.h" 41 #include "ios/chrome/grit/ios_strings.h"
41 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MDCActivityIndicator.h" 42 #import "ios/third_party/material_components_ios/src/components/ActivityIndicato r/src/MDCActivityIndicator.h"
42 #import "ios/third_party/material_components_ios/src/components/Collections/src/ MaterialCollections.h" 43 #import "ios/third_party/material_components_ios/src/components/Collections/src/ MaterialCollections.h"
43 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h" 44 #import "ios/third_party/material_components_ios/src/components/Palettes/src/Mat erialPalettes.h"
45 #import "ios/third_party/material_components_ios/src/components/Typography/src/M aterialTypography.h"
44 #import "ios/web/public/referrer.h" 46 #import "ios/web/public/referrer.h"
45 #import "ios/web/public/web_state/context_menu_params.h" 47 #import "ios/web/public/web_state/context_menu_params.h"
46 #import "net/base/mac/url_conversions.h" 48 #import "net/base/mac/url_conversions.h"
47 #include "ui/base/l10n/l10n_util.h" 49 #include "ui/base/l10n/l10n_util.h"
48 #include "ui/base/l10n/l10n_util_mac.h" 50 #include "ui/base/l10n/l10n_util_mac.h"
49 51
50 #if !defined(__has_feature) || !__has_feature(objc_arc) 52 #if !defined(__has_feature) || !__has_feature(objc_arc)
51 #error "This file requires ARC support." 53 #error "This file requires ARC support."
52 #endif 54 #endif
53 55
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 return height; 463 return height;
462 } 464 }
463 } 465 }
464 466
465 - (MDCCollectionViewCellStyle)collectionView:(UICollectionView*)collectionView 467 - (MDCCollectionViewCellStyle)collectionView:(UICollectionView*)collectionView
466 cellStyleForSection:(NSInteger)section { 468 cellStyleForSection:(NSInteger)section {
467 return section ? MDCCollectionViewCellStyleCard 469 return section ? MDCCollectionViewCellStyleCard
468 : MDCCollectionViewCellStyleDefault; 470 : MDCCollectionViewCellStyleDefault;
469 } 471 }
470 472
473 #pragma mark - UICollectionViewDataSource
474
475 - (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
476 cellForItemAtIndexPath:(nonnull NSIndexPath*)indexPath {
477 UICollectionViewCell* cell =
478 [super collectionView:collectionView cellForItemAtIndexPath:indexPath];
479
480 if ([cell isKindOfClass:[CollectionViewTextCell class]]) {
481 CollectionViewTextCell* textCell =
482 base::mac::ObjCCastStrict<CollectionViewTextCell>(cell);
483 textCell.textLabel.font = [MDCTypography body2Font];
484 textCell.textLabel.textColor = [[MDCPalette greyPalette] tint900];
485 textCell.detailTextLabel.font = [MDCTypography body1Font];
486 textCell.detailTextLabel.textColor = [[MDCPalette greyPalette] tint500];
487 }
488 return cell;
489 }
490
471 #pragma mark - UICollectionViewDelegate 491 #pragma mark - UICollectionViewDelegate
472 492
473 - (BOOL)collectionView:(UICollectionView*)collectionView 493 - (BOOL)collectionView:(UICollectionView*)collectionView
474 shouldSelectItemAtIndexPath:(NSIndexPath*)indexPath { 494 shouldSelectItemAtIndexPath:(NSIndexPath*)indexPath {
475 // The first section is not selectable. 495 // The first section is not selectable.
476 return indexPath.section && [super collectionView:collectionView 496 return indexPath.section && [super collectionView:collectionView
477 shouldSelectItemAtIndexPath:indexPath]; 497 shouldSelectItemAtIndexPath:indexPath];
478 } 498 }
479 499
480 - (void)collectionView:(UICollectionView*)collectionView 500 - (void)collectionView:(UICollectionView*)collectionView
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 shouldCloseWithCompletion:^{ 834 shouldCloseWithCompletion:^{
815 [self.URLLoader webPageOrderedOpen:copiedURL 835 [self.URLLoader webPageOrderedOpen:copiedURL
816 referrer:web::Referrer() 836 referrer:web::Referrer()
817 inIncognito:YES 837 inIncognito:YES
818 inBackground:NO 838 inBackground:NO
819 appendTo:kLastTab]; 839 appendTo:kLastTab];
820 }]; 840 }];
821 } 841 }
822 842
823 @end 843 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698