Commit 2d1d94ea authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[multiball] Use the global dispatcher for BrowsingDataCommands.

Instead of exposing MainController's conformance to BrowsingDataCommands
use the app state's dispatcher to access it.

Bug: 1045659
Change-Id: I71bd5d4693d5d2eefdc67def9abb345a84d24ce5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418336
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810242}
parent 5763b8de
......@@ -29,6 +29,7 @@
#import "ios/chrome/app/deferred_initialization_runner.h"
#import "ios/chrome/app/memory_monitor.h"
#import "ios/chrome/app/spotlight/spotlight_manager.h"
#include "ios/chrome/app/startup/chrome_app_startup_parameters.h"
#include "ios/chrome/app/startup/chrome_main_starter.h"
#include "ios/chrome/app/startup/client_registration.h"
#include "ios/chrome/app/startup/ios_chrome_main.h"
......@@ -53,6 +54,7 @@
#include "ios/chrome/browser/crash_report/crash_keys_helper.h"
#include "ios/chrome/browser/crash_report/crash_loop_detection_util.h"
#include "ios/chrome/browser/crash_report/crash_report_helper.h"
#import "ios/chrome/browser/crash_report/crash_restore_helper.h"
#include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h"
#include "ios/chrome/browser/credential_provider/credential_provider_support.h"
#include "ios/chrome/browser/download/download_directory_util.h"
......@@ -388,6 +390,9 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self.appState.appCommandDispatcher
startDispatchingToTarget:self
forProtocol:@protocol(BlockingSceneCommands)];
[self.appState.appCommandDispatcher
startDispatchingToTarget:self
forProtocol:@protocol(BrowsingDataCommands)];
if (@available(iOS 13, *)) {
if (IsSceneStartupSupported()) {
......
......@@ -7,21 +7,10 @@
#import <UIKit/UIKit.h>
#import "base/ios/block_types.h"
#include "components/browsing_data/core/browsing_data_utils.h"
#import "ios/chrome/app/application_delegate/startup_information.h"
#include "ios/chrome/app/startup/chrome_app_startup_parameters.h"
#include "ios/chrome/browser/browsing_data/browsing_data_remove_mask.h"
#import "ios/chrome/browser/crash_report/crash_restore_helper.h"
#import "ios/chrome/browser/ui/commands/browsing_data_commands.h"
@class AppState;
class ChromeBrowserState;
// TODO(crbug.com/1012697): Remove this protocol when SceneController is
// operational. Move the private internals back into MainController, and pass
// ownership of Scene-related objects to SceneController.
@protocol MainControllerGuts <BrowsingDataCommands>
@protocol MainControllerGuts
// MainController tracks EULA acceptance and performs delayed tasks when the
// first run UI is dismissed.
......
......@@ -13,6 +13,7 @@
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/url_formatter/url_formatter.h"
#import "ios/chrome/app/application_delegate/app_state.h"
#import "ios/chrome/app/application_delegate/startup_information.h"
#include "ios/chrome/app/application_delegate/tab_opening.h"
#import "ios/chrome/app/application_delegate/url_opener.h"
#import "ios/chrome/app/application_delegate/url_opener_params.h"
......@@ -33,6 +34,7 @@
#include "ios/chrome/browser/crash_report/breadcrumbs/features.h"
#include "ios/chrome/browser/crash_report/crash_keys_helper.h"
#include "ios/chrome/browser/crash_report/crash_report_helper.h"
#import "ios/chrome/browser/crash_report/crash_restore_helper.h"
#import "ios/chrome/browser/first_run/first_run.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/main/browser_list.h"
......@@ -50,6 +52,7 @@
#import "ios/chrome/browser/ui/authentication/signin/signin_utils.h"
#import "ios/chrome/browser/ui/browser_view/browser_view_controller.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/commands/browsing_data_commands.h"
#import "ios/chrome/browser/ui/commands/command_dispatcher.h"
#import "ios/chrome/browser/ui/commands/omnibox_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
......@@ -245,13 +248,18 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
#pragma mark - Setters and getters
- (id<BrowsingDataCommands>)browsingDataCommandsHandler {
return HandlerForProtocol(self.sceneState.appState.appCommandDispatcher,
BrowsingDataCommands);
}
- (TabGridCoordinator*)mainCoordinator {
if (!_mainCoordinator) {
// Lazily create the main coordinator.
TabGridCoordinator* tabGridCoordinator = [[TabGridCoordinator alloc]
initWithWindow:self.sceneState.window
applicationCommandEndpoint:self
browsingDataCommandEndpoint:self.mainController
browsingDataCommandEndpoint:self.browsingDataCommandsHandler
regularBrowser:self.mainInterface.browser
incognitoBrowser:self.incognitoInterface.browser];
_mainCoordinator = tabGridCoordinator;
......@@ -542,7 +550,7 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
initWithBrowserState:self.sceneState.appState.mainBrowserState
sceneState:self.sceneState
applicationCommandEndpoint:self
browsingDataCommandEndpoint:self.mainController];
browsingDataCommandEndpoint:self.browsingDataCommandsHandler];
// Ensure the main browser is created. This also creates the BVC.
[self.browserViewWrangler createMainBrowser];
......@@ -2117,7 +2125,7 @@ const char kMultiWindowOpenInNewWindowHistogram[] =
ChromeBrowserState* otrBrowserState =
self.sceneState.appState.mainBrowserState
->GetOffTheRecordChromeBrowserState();
[self.mainController
[self.browsingDataCommandsHandler
removeBrowsingDataForBrowserState:otrBrowserState
timePeriod:browsing_data::TimePeriod::ALL_TIME
removeMask:BrowsingDataRemoveMask::REMOVE_ALL
......
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