Commit e8de6b39 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Add tableview/collectionview flag in ClearBrowsingDataManager

Helps determine which kind of ListItem to put into the view controller's model.

Change-Id: I5a5e64a533e160a497eb5d3b59070f3ec534c028
Reviewed-on: https://chromium-review.googlesource.com/1092096
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566518}
parent c1433983
...@@ -118,9 +118,9 @@ void BrowsingDataRemoverObserverWrapper::OnBrowsingDataRemoved( ...@@ -118,9 +118,9 @@ void BrowsingDataRemoverObserverWrapper::OnBrowsingDataRemoved(
self.accessibilityTraits |= UIAccessibilityTraitButton; self.accessibilityTraits |= UIAccessibilityTraitButton;
_browserState = browserState; _browserState = browserState;
_dataManager = [[ClearBrowsingDataManager alloc]
_dataManager = initWithBrowserState:browserState
[[ClearBrowsingDataManager alloc] initWithBrowserState:browserState]; managingListOfType:ClearBrowsingDataListType::CollectionView];
_dataManager.linkDelegate = self; _dataManager.linkDelegate = self;
_dataManager.consumer = self; _dataManager.consumer = self;
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
@implementation ClearBrowsingDataCoordinator @implementation ClearBrowsingDataCoordinator
- (void)start { - (void)start {
ClearBrowsingDataTableViewController* clearBrowsingDataTVC = ClearBrowsingDataTableViewController* clearBrowsingDataTableViewController =
[[ClearBrowsingDataTableViewController alloc] init]; [[ClearBrowsingDataTableViewController alloc] init];
clearBrowsingDataTVC.extendedLayoutIncludesOpaqueBars = YES; clearBrowsingDataTableViewController.extendedLayoutIncludesOpaqueBars = YES;
// We currently know for sure that baseViewController is a // We currently know for sure that baseViewController is a
// Navigation Controller. // Navigation Controller.
// Todo: there should be a way to stop coordinators once they've been pushed // Todo: there should be a way to stop coordinators once they've been pushed
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
UINavigationController* tableViewNavigationController = UINavigationController* tableViewNavigationController =
base::mac::ObjCCastStrict<UINavigationController>( base::mac::ObjCCastStrict<UINavigationController>(
self.baseViewController); self.baseViewController);
[tableViewNavigationController pushViewController:clearBrowsingDataTVC [tableViewNavigationController
animated:YES]; pushViewController:clearBrowsingDataTableViewController
animated:YES];
} }
@end @end
...@@ -57,6 +57,11 @@ enum ClearBrowsingDataItemType { ...@@ -57,6 +57,11 @@ enum ClearBrowsingDataItemType {
ItemTypeTimeRange, ItemTypeTimeRange,
}; };
enum class ClearBrowsingDataListType {
TableView = 0,
CollectionView,
};
// Manager that serves as the bulk of the logic for // Manager that serves as the bulk of the logic for
// ClearBrowsingDataConsumer. // ClearBrowsingDataConsumer.
@interface ClearBrowsingDataManager @interface ClearBrowsingDataManager
...@@ -67,8 +72,10 @@ enum ClearBrowsingDataItemType { ...@@ -67,8 +72,10 @@ enum ClearBrowsingDataItemType {
// Reference to the LinkDelegate for CollectionViewFooterItem. // Reference to the LinkDelegate for CollectionViewFooterItem.
@property(nonatomic, strong) id<CollectionViewFooterLinkDelegate> linkDelegate; @property(nonatomic, strong) id<CollectionViewFooterLinkDelegate> linkDelegate;
// Default init method with |browserState| that can't be nil. // Default init method. |browserState| can't be nil and
// |managingList| determines what kind of items to populate model with.
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
managingListOfType:(ClearBrowsingDataListType)listType
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
......
...@@ -67,6 +67,9 @@ const int kMaxTimesHistoryNoticeShown = 1; ...@@ -67,6 +67,9 @@ const int kMaxTimesHistoryNoticeShown = 1;
// Whether to show popup other forms of browsing history. // Whether to show popup other forms of browsing history.
@property(nonatomic, assign) @property(nonatomic, assign)
BOOL shouldPopupDialogAboutOtherFormsOfBrowsingHistory; BOOL shouldPopupDialogAboutOtherFormsOfBrowsingHistory;
// Whether the mediator is managing a TableViewController or a
// CollectionsViewController.
@property(nonatomic, assign) ClearBrowsingDataListType listType;
@end @end
...@@ -79,11 +82,14 @@ const int kMaxTimesHistoryNoticeShown = 1; ...@@ -79,11 +82,14 @@ const int kMaxTimesHistoryNoticeShown = 1;
_shouldShowNoticeAboutOtherFormsOfBrowsingHistory; _shouldShowNoticeAboutOtherFormsOfBrowsingHistory;
@synthesize shouldPopupDialogAboutOtherFormsOfBrowsingHistory = @synthesize shouldPopupDialogAboutOtherFormsOfBrowsingHistory =
_shouldPopupDialogAboutOtherFormsOfBrowsingHistory; _shouldPopupDialogAboutOtherFormsOfBrowsingHistory;
@synthesize listType = _listType;
- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState { - (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState
managingListOfType:(ClearBrowsingDataListType)listType {
self = [super init]; self = [super init];
if (self) { if (self) {
_browserState = browserState; _browserState = browserState;
_listType = listType;
_timePeriod = browsing_data::TimePeriod::ALL_TIME; _timePeriod = browsing_data::TimePeriod::ALL_TIME;
if (experimental_flags::IsNewClearBrowsingDataUIEnabled()) { if (experimental_flags::IsNewClearBrowsingDataUIEnabled()) {
......
...@@ -63,7 +63,8 @@ class ClearBrowsingDataManagerTest : public PlatformTest { ...@@ -63,7 +63,8 @@ class ClearBrowsingDataManagerTest : public PlatformTest {
model_ = [[CollectionViewModel alloc] init]; model_ = [[CollectionViewModel alloc] init];
manager_ = [[ClearBrowsingDataManager alloc] manager_ = [[ClearBrowsingDataManager alloc]
initWithBrowserState:browser_state_.get()]; initWithBrowserState:browser_state_.get()
managingListOfType:ClearBrowsingDataListType::CollectionView];
signin_manager_ = signin_manager_ =
ios::SigninManagerFactory::GetForBrowserState(browser_state_.get()); ios::SigninManagerFactory::GetForBrowserState(browser_state_.get());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment