Commit 7ef2e764 authored by Nazerke's avatar Nazerke Committed by Commit Bot

[iOS][cleanup] Rename HistoryLocalCommands to HistoryUIDelegate.

HistoryLocalCommands isn't configured through the dispatcher. This CL
renames this protocol (HistoryLocalCommands) to "HistoryUIDelegate",
and renames all of the "localDispatcher" properties to be named
"delegate".

Change-Id: I7fc79e2053292e994ef2db1129b78575fee5112d
Bug: none.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062446
Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743226}
parent d288c3f8
......@@ -59,11 +59,11 @@ source_set("history_ui") {
"history_entry_item.mm",
"history_entry_item_delegate.h",
"history_entry_item_interface.h",
"history_local_commands.h",
"history_table_view_controller.h",
"history_table_view_controller.mm",
"history_transitioning_delegate.h",
"history_transitioning_delegate.mm",
"history_ui_delegate.h",
"history_util.h",
"history_util.mm",
]
......
......@@ -10,7 +10,7 @@
enum class UrlLoadStrategy;
@protocol HistoryLocalCommands;
@protocol HistoryUIDelegate;
@protocol HistoryPresentationDelegate;
@protocol HistoryClearBrowsingDataLocalCommands;
......@@ -28,7 +28,7 @@ enum class UrlLoadStrategy;
NS_UNAVAILABLE;
// Delegate for this coordinator.
@property(nonatomic, weak) id<HistoryLocalCommands> localDispatcher;
@property(nonatomic, weak) id<HistoryUIDelegate> delegate;
// Opaque instructions on how to open urls.
@property(nonatomic) UrlLoadStrategy loadStrategy;
......
......@@ -8,7 +8,7 @@
#include "base/mac/foundation_util.h"
#import "ios/chrome/browser/main/browser.h"
#include "ios/chrome/browser/ui/history/history_local_commands.h"
#include "ios/chrome/browser/ui/history/history_ui_delegate.h"
#import "ios/chrome/browser/ui/history/public/history_presentation_delegate.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_local_commands.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h"
......@@ -42,7 +42,7 @@
_clearBrowsingDataTableViewController;
@synthesize historyClearBrowsingDataNavigationController =
_historyClearBrowsingDataNavigationController;
@synthesize localDispatcher = _localDispatcher;
@synthesize delegate = _delegate;
@synthesize presentationDelegate = _presentationDelegate;
- (void)start {
......@@ -122,7 +122,7 @@
UrlLoadParams params = UrlLoadParams::InNewTab(URL);
params.load_strategy = self.loadStrategy;
[self stopWithCompletion:^() {
[self.localDispatcher dismissHistoryWithCompletion:^{
[self.delegate dismissHistoryWithCompletion:^{
UrlLoadingServiceFactory::GetForBrowserState(
self.browser->GetBrowserState())
->Load(params);
......
......@@ -12,10 +12,10 @@
#include "ios/chrome/browser/sync/profile_sync_service_factory.h"
#import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h"
#import "ios/chrome/browser/ui/history/history_clear_browsing_data_coordinator.h"
#include "ios/chrome/browser/ui/history/history_local_commands.h"
#import "ios/chrome/browser/ui/history/history_mediator.h"
#include "ios/chrome/browser/ui/history/history_table_view_controller.h"
#import "ios/chrome/browser/ui/history/history_transitioning_delegate.h"
#include "ios/chrome/browser/ui/history/history_ui_delegate.h"
#include "ios/chrome/browser/ui/history/ios_browsing_history_driver.h"
#import "ios/chrome/browser/ui/table_view/feature_flags.h"
#import "ios/chrome/browser/ui/table_view/table_view_navigation_controller.h"
......@@ -25,7 +25,7 @@
#error "This file requires ARC support."
#endif
@interface HistoryCoordinator ()<HistoryLocalCommands> {
@interface HistoryCoordinator () <HistoryUIDelegate> {
// Provides dependencies and funnels callbacks from BrowsingHistoryService.
std::unique_ptr<IOSBrowsingHistoryDriver> _browsingHistoryDriver;
// Abstraction to communicate with HistoryService and WebHistoryService.
......@@ -86,7 +86,7 @@
self.historyNavigationController = [[TableViewNavigationController alloc]
initWithTable:self.historyTableViewController];
self.historyNavigationController.toolbarHidden = NO;
self.historyTableViewController.localDispatcher = self;
self.historyTableViewController.delegate = self;
self.historyTableViewController.presentationDelegate =
self.presentationDelegate;
......@@ -149,7 +149,7 @@
}
}
#pragma mark - HistoryLocalCommands
#pragma mark - HistoryUIDelegate
- (void)dismissHistoryWithCompletion:(ProceduralBlock)completionHandler {
[self stopWithCompletion:completionHandler];
......@@ -160,7 +160,7 @@
[[HistoryClearBrowsingDataCoordinator alloc]
initWithBaseViewController:self.historyNavigationController
browser:self.browser];
self.historyClearBrowsingDataCoordinator.localDispatcher = self;
self.historyClearBrowsingDataCoordinator.delegate = self;
self.historyClearBrowsingDataCoordinator.presentationDelegate =
self.presentationDelegate;
self.historyClearBrowsingDataCoordinator.loadStrategy = self.loadStrategy;
......
......@@ -14,7 +14,7 @@ enum class UrlLoadStrategy;
@class ContextMenuCoordinator;
@protocol TableViewFaviconDataSource;
@protocol HistoryLocalCommands;
@protocol HistoryUIDelegate;
@protocol HistoryPresentationDelegate;
// ChromeTableViewController for displaying history items.
......@@ -29,7 +29,7 @@ enum class UrlLoadStrategy;
// Opaque instructions on how to open urls.
@property(nonatomic) UrlLoadStrategy loadStrategy;
// Delegate for this HistoryTableView.
@property(nonatomic, weak) id<HistoryLocalCommands> localDispatcher;
@property(nonatomic, weak) id<HistoryUIDelegate> delegate;
// Delegate used to make the Tab UI visible.
@property(nonatomic, weak) id<HistoryPresentationDelegate> presentationDelegate;
// Data source for favicon images.
......
......@@ -22,8 +22,8 @@
#include "ios/chrome/browser/ui/history/history_entry_inserter.h"
#import "ios/chrome/browser/ui/history/history_entry_item.h"
#import "ios/chrome/browser/ui/history/history_entry_item_delegate.h"
#include "ios/chrome/browser/ui/history/history_local_commands.h"
#import "ios/chrome/browser/ui/history/history_ui_constants.h"
#include "ios/chrome/browser/ui/history/history_ui_delegate.h"
#include "ios/chrome/browser/ui/history/history_util.h"
#import "ios/chrome/browser/ui/history/public/history_presentation_delegate.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h"
......@@ -487,9 +487,9 @@ const CGFloat kButtonHorizontalPadding = 30.0;
- (void)presentationControllerDidDismiss:
(UIPresentationController*)presentationController {
// Call the localDispatcher dismissHistoryWithCompletion to clean up state and
// Call the delegate dismissHistoryWithCompletion to clean up state and
// stop the Coordinator.
[self.localDispatcher dismissHistoryWithCompletion:nil];
[self.delegate dismissHistoryWithCompletion:nil];
}
#pragma mark - History Data Updates
......@@ -1039,7 +1039,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
base::RecordAction(
base::UserMetricsAction("MobileHistoryPage_EntryLinkOpenNewTab"));
UrlLoadParams params = UrlLoadParams::InNewTab(URL);
[self.localDispatcher dismissHistoryWithCompletion:^{
[self.delegate dismissHistoryWithCompletion:^{
UrlLoadingServiceFactory::GetForBrowserState(_browserState)->Load(params);
[self.presentationDelegate showActiveRegularTabFromHistory];
}];
......@@ -1051,7 +1051,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
"MobileHistoryPage_EntryLinkOpenNewIncognitoTab"));
UrlLoadParams params = UrlLoadParams::InNewTab(URL);
params.in_incognito = YES;
[self.localDispatcher dismissHistoryWithCompletion:^{
[self.delegate dismissHistoryWithCompletion:^{
UrlLoadingServiceFactory::GetForBrowserState(_browserState)->Load(params);
[self.presentationDelegate showActiveIncognitoTabFromHistory];
}];
......@@ -1067,7 +1067,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
UrlLoadParams params = UrlLoadParams::InCurrentTab(URL);
params.web_params.transition_type = ui::PAGE_TRANSITION_AUTO_BOOKMARK;
params.load_strategy = self.loadStrategy;
[self.localDispatcher dismissHistoryWithCompletion:^{
[self.delegate dismissHistoryWithCompletion:^{
UrlLoadingServiceFactory::GetForBrowserState(_browserState)->Load(params);
[self.presentationDelegate showActiveRegularTabFromHistory];
}];
......@@ -1075,19 +1075,19 @@ const CGFloat kButtonHorizontalPadding = 30.0;
// Dismisses this ViewController.
- (void)dismissHistory {
[self.localDispatcher dismissHistoryWithCompletion:nil];
[self.delegate dismissHistoryWithCompletion:nil];
}
- (void)openPrivacySettings {
base::RecordAction(
base::UserMetricsAction("HistoryPage_InitClearBrowsingData"));
[self.localDispatcher displayPrivacySettings];
[self.delegate displayPrivacySettings];
}
#pragma mark - Accessibility
- (BOOL)accessibilityPerformEscape {
[self.localDispatcher dismissHistoryWithCompletion:nil];
[self.delegate dismissHistoryWithCompletion:nil];
return YES;
}
......
......@@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_LOCAL_COMMANDS_H_
#define IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_LOCAL_COMMANDS_H_
#ifndef IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_UI_DELEGATE_H_
#define IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_UI_DELEGATE_H_
#include "base/ios/block_types.h"
// Protocol to communicate HistoryTableViewController actions to its
// coordinator.
@protocol HistoryLocalCommands
@protocol HistoryUIDelegate
// Notifies the coordinator that history should be dismissed.
- (void)dismissHistoryWithCompletion:(ProceduralBlock)completionHandler;
// Notifies the coordinator that Privacy Settings should be displayed.
- (void)displayPrivacySettings;
@end
#endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_LOCAL_COMMANDS_H_
#endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_UI_DELEGATE_H_
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