Commit 5af3e2a4 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Presents CBD modally from HistoryCoordinator.

-This CL re-introduces the ClearBrowsingData modal presentation from HistoryCoordinator
via HistoryTableVC.

-Creates a new displayPrivacySettings localDispatcher command.

Bug: 805192
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Ia62f7f491b39e49c7d90bffb8bf42504ff343a13
Reviewed-on: https://chromium-review.googlesource.com/1026873Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553611}
parent 1780022b
......@@ -120,7 +120,6 @@ source_set("history_ui") {
"//ios/chrome/browser/sync",
"//ios/chrome/browser/ui",
"//ios/chrome/browser/ui/collection_view/cells",
"//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/context_menu",
"//ios/chrome/browser/ui/list_model",
"//ios/chrome/browser/ui/table_view",
......
......@@ -11,6 +11,7 @@
#include "components/keyed_service/core/service_access_type.h"
#include "ios/chrome/browser/history/history_service_factory.h"
#include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#include "ios/chrome/browser/ui/history/history_local_commands.h"
#include "ios/chrome/browser/ui/history/history_table_view_controller.h"
#import "ios/chrome/browser/ui/history/history_transitioning_delegate.h"
......@@ -94,4 +95,11 @@
[self stopWithCompletion:completionHandler];
}
- (void)displayPrivacySettings {
// TODO(crbug.com/805201): We need to push CBD into the NavigationController
// instead of presenting it modally.
[self.dispatcher showClearBrowsingDataSettingsFromViewController:
self.historyNavigationController];
}
@end
......@@ -12,6 +12,8 @@
@protocol HistoryLocalCommands
// 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_
......@@ -15,7 +15,6 @@
#import "ios/chrome/browser/metrics/new_tab_page_uma.h"
#include "ios/chrome/browser/sync/sync_setup_service.h"
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/context_menu/context_menu_coordinator.h"
#include "ios/chrome/browser/ui/history/history_entries_status_item.h"
#import "ios/chrome/browser/ui/history/history_entries_status_item_delegate.h"
......@@ -824,6 +823,16 @@ const int kMaxFetchCount = 100;
[self.localDispatcher dismissHistoryWithCompletion:nil];
}
- (void)openPrivacySettings {
// Ignore the button tap if |self| is presenting another ViewController.
if ([self presentedViewController]) {
return;
}
base::RecordAction(
base::UserMetricsAction("HistoryPage_InitClearBrowsingData"));
[self.localDispatcher displayPrivacySettings];
}
#pragma mark Setter & Getters
- (UIBarButtonItem*)cancelButton {
......@@ -839,6 +848,8 @@ const int kMaxFetchCount = 100;
return _cancelButton;
}
// TODO(crbug.com/831865): Find a way to disable the button when a VC is
// presented.
- (UIBarButtonItem*)clearBrowsingDataButton {
if (!_clearBrowsingDataButton) {
NSString* titleString = l10n_util::GetNSStringWithFixup(
......@@ -846,8 +857,8 @@ const int kMaxFetchCount = 100;
_clearBrowsingDataButton =
[[UIBarButtonItem alloc] initWithTitle:titleString
style:UIBarButtonItemStylePlain
target:nil
action:nil];
target:self
action:@selector(openPrivacySettings)];
_clearBrowsingDataButton.tintColor = [UIColor redColor];
}
return _clearBrowsingDataButton;
......
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