| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_ITEM_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_ITEM_H_ |
| 7 |
| 8 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" |
| 9 #import "ios/third_party/material_components_ios/src/components/Collections/src/
MaterialCollections.h" |
| 10 |
| 11 namespace base { |
| 12 class Time; |
| 13 } // namespace base |
| 14 |
| 15 namespace history { |
| 16 struct HistoryEntry; |
| 17 } // namespace history |
| 18 |
| 19 namespace ios { |
| 20 class ChromeBrowserState; |
| 21 } // namespace ios |
| 22 |
| 23 @class FaviconView; |
| 24 @protocol FaviconViewProviderDelegate; |
| 25 class GURL; |
| 26 @class HistoryEntryItem; |
| 27 |
| 28 // Delegate for HistoryEntryItem. Handles actions invoked as custom |
| 29 // accessibility actions. |
| 30 @protocol HistoryEntryItemDelegate |
| 31 // Called when custom accessibility action to delete the entry is invoked. |
| 32 - (void)historyEntryItemDidRequestDelete:(HistoryEntryItem*)item; |
| 33 // Called when custom accessibility action to open the entry in a new tab is |
| 34 // invoked. |
| 35 - (void)historyEntryItemDidRequestOpenInNewTab:(HistoryEntryItem*)item; |
| 36 // Called when custom accessibility action to open the entry in a new incognito |
| 37 // tab is invoked. |
| 38 - (void)historyEntryItemDidRequestOpenInNewIncognitoTab:(HistoryEntryItem*)item; |
| 39 // Called when custom accessibility action to copy the entry's URL is invoked. |
| 40 - (void)historyEntryItemDidRequestCopy:(HistoryEntryItem*)item; |
| 41 // Called when the view associated with the HistoryEntryItem should be updated. |
| 42 - (void)historyEntryItemShouldUpdateView:(HistoryEntryItem*)item; |
| 43 @end |
| 44 |
| 45 // Model object for the cell that displays a history entry. |
| 46 @interface HistoryEntryItem : CollectionViewItem |
| 47 |
| 48 // Text for the content view. Rendered at the top trailing the favicon. |
| 49 @property(nonatomic, copy) NSString* text; |
| 50 // Detail text for content view. Rendered below text. |
| 51 @property(nonatomic, copy) NSString* detailText; |
| 52 // Text for the time stamp. Rendered aligned to trailing edge at same level as |
| 53 // |text|. |
| 54 @property(nonatomic, copy) NSString* timeText; |
| 55 // URL of the associated history entry. |
| 56 @property(nonatomic, assign) GURL URL; |
| 57 // Timestamp of the associated history entry. |
| 58 @property(nonatomic, assign) base::Time timestamp; |
| 59 |
| 60 // The |delegate| is notified when the favicon has loaded, and may be nil. |
| 61 - (instancetype)initWithType:(NSInteger)type |
| 62 historyEntry:(const history::HistoryEntry&)entry |
| 63 browserState:(ios::ChromeBrowserState*)browserState |
| 64 delegate:(id<HistoryEntryItemDelegate>)delegate |
| 65 NS_DESIGNATED_INITIALIZER; |
| 66 - (instancetype)initWithType:(NSInteger)type NS_UNAVAILABLE; |
| 67 |
| 68 // HistoryEntryItems are equal if they have the same URL and |
| 69 // timestamp. |
| 70 - (BOOL)isEqualToHistoryEntryItem:(HistoryEntryItem*)item; |
| 71 |
| 72 @end |
| 73 |
| 74 // Cell that renders a history entry. |
| 75 @interface HistoryEntryCell : MDCCollectionViewCell |
| 76 |
| 77 // View for displaying the favicon for the history entry. |
| 78 @property(nonatomic, retain) UIView* faviconViewContainer; |
| 79 // Text label for history entry title. |
| 80 @property(nonatomic, readonly, retain) UILabel* textLabel; |
| 81 // Text label for history entry URL. |
| 82 @property(nonatomic, readonly, retain) UILabel* detailTextLabel; |
| 83 // Text label for history entry timestamp. |
| 84 @property(nonatomic, readonly, retain) UILabel* timeLabel; |
| 85 |
| 86 @end |
| 87 |
| 88 #endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_ITEM_H_ |
| OLD | NEW |