Commit 0a9b6224 authored by Stepan Khapugin's avatar Stepan Khapugin Committed by Commit Bot

[iOS][multiball] Move AppNavigation to SceneController.

Moves AppNavigation protocol implementation to SceneController.

Bug: none
Change-Id: I41732781203fae618ce5b5651a1f3be47576a816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2002521Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732858}
parent 9b365a74
...@@ -19,7 +19,7 @@ class ChromeBrowserState; ...@@ -19,7 +19,7 @@ class ChromeBrowserState;
@protocol AppNavigation<NSObject> @protocol AppNavigation<NSObject>
// Navigation View controller for the settings. // Navigation View controller for the settings.
@property(nonatomic, retain) @property(nonatomic, strong)
SettingsNavigationController* settingsNavigationController; SettingsNavigationController* settingsNavigationController;
// Presents a SignedInAccountsViewController for |browserState| on the top view // Presents a SignedInAccountsViewController for |browserState| on the top view
......
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
_appState = [[AppState alloc] initWithBrowserLauncher:_browserLauncher _appState = [[AppState alloc] initWithBrowserLauncher:_browserLauncher
startupInformation:_startupInformation startupInformation:_startupInformation
applicationDelegate:self]; applicationDelegate:self];
_appNavigation = _mainController;
[_mainController setAppState:_appState]; [_mainController setAppState:_appState];
if (!IsMultiwindowSupported()) { if (!IsMultiwindowSupported()) {
...@@ -91,6 +90,7 @@ ...@@ -91,6 +90,7 @@
_mainController.sceneController = _sceneController; _mainController.sceneController = _sceneController;
_tabSwitcherProtocol = _sceneController; _tabSwitcherProtocol = _sceneController;
_tabOpener = _sceneController; _tabOpener = _sceneController;
_appNavigation = _sceneController;
} }
} }
return self; return self;
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/browser_launcher.h" #import "ios/chrome/app/application_delegate/browser_launcher.h"
#import "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/app/application_delegate/startup_information.h"
#import "ios/chrome/app/main_controller_guts.h" #import "ios/chrome/app/main_controller_guts.h"
...@@ -28,8 +27,7 @@ ...@@ -28,8 +27,7 @@
// //
// By design, it has no public API of its own. Anything interacting with // By design, it has no public API of its own. Anything interacting with
// MainController should be doing so through a specific protocol. // MainController should be doing so through a specific protocol.
@interface MainController : NSObject <AppNavigation, @interface MainController : NSObject <BrowserLauncher,
BrowserLauncher,
MainControllerGuts, MainControllerGuts,
StartupInformation, StartupInformation,
BrowsingDataCommands> BrowsingDataCommands>
......
...@@ -129,7 +129,6 @@ ...@@ -129,7 +129,6 @@
#import "ios/chrome/browser/ui/tab_grid/view_controller_swapping.h" #import "ios/chrome/browser/ui/tab_grid/view_controller_swapping.h"
#import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h" #import "ios/chrome/browser/ui/toolbar/public/omnibox_focuser.h"
#import "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/ui_feature_flags.h"
#import "ios/chrome/browser/ui/util/top_view_controller.h"
#include "ios/chrome/browser/ui/util/ui_util.h" #include "ios/chrome/browser/ui/util/ui_util.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h" #import "ios/chrome/browser/ui/webui/chrome_web_ui_ios_controller_factory.h"
...@@ -441,7 +440,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -441,7 +440,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
@implementation MainController @implementation MainController
// Defined by MainControllerGuts. // Defined by MainControllerGuts.
@synthesize historyCoordinator; @synthesize historyCoordinator;
@synthesize settingsNavigationController;
@synthesize appURLLoadingService; @synthesize appURLLoadingService;
@synthesize isProcessingTabSwitcherCommand; @synthesize isProcessingTabSwitcherCommand;
@synthesize isProcessingVoiceSearchCommand; @synthesize isProcessingVoiceSearchCommand;
...@@ -819,7 +817,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -819,7 +817,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
} }
- (BOOL)isSettingsViewPresented { - (BOOL)isSettingsViewPresented {
return self.settingsNavigationController || return [self.sceneController hasSettingsNavigationController] ||
self.signinInteractionCoordinator.isSettingsViewPresented; self.signinInteractionCoordinator.isSettingsViewPresented;
} }
...@@ -999,7 +997,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -999,7 +997,7 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
if ([SignedInAccountsViewController if ([SignedInAccountsViewController
shouldBePresentedForBrowserState: shouldBePresentedForBrowserState:
[self currentBrowserState]]) { [self currentBrowserState]]) {
[self [self.sceneController
presentSignedInAccountsViewControllerForBrowserState: presentSignedInAccountsViewControllerForBrowserState:
[self currentBrowserState]]; [self currentBrowserState]];
} }
...@@ -1557,25 +1555,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1557,25 +1555,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
[self.mainCoordinator showTabSwitcher:_tabSwitcher]; [self.mainCoordinator showTabSwitcher:_tabSwitcher];
} }
#pragma mark - App Navigation
- (void)presentSignedInAccountsViewControllerForBrowserState:
(ios::ChromeBrowserState*)browserState {
UIViewController* accountsViewController =
[[SignedInAccountsViewController alloc]
initWithBrowserState:browserState
dispatcher:self.mainBVC.dispatcher];
[[self topPresentedViewController]
presentViewController:accountsViewController
animated:YES
completion:nil];
}
- (void)closeSettingsAnimated:(BOOL)animated
completion:(ProceduralBlock)completion {
[self.sceneController closeSettingsAnimated:animated completion:completion];
}
#pragma mark - WebStateListObserving #pragma mark - WebStateListObserving
// Called when a WebState is removed. Triggers the switcher view when the last // Called when a WebState is removed. Triggers the switcher view when the last
...@@ -1763,13 +1742,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -1763,13 +1742,6 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
_tabSwitcher = switcher; _tabSwitcher = switcher;
} }
- (UIViewController*)topPresentedViewController {
// TODO(crbug.com/754642): Implement TopPresentedViewControllerFrom()
// privately.
return top_view_controller::TopPresentedViewControllerFrom(
self.mainCoordinator.viewController);
}
- (void)setTabSwitcherActive:(BOOL)active { - (void)setTabSwitcherActive:(BOOL)active {
self.tabSwitcherIsActive = active; self.tabSwitcherIsActive = active;
} }
......
...@@ -36,8 +36,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO }; ...@@ -36,8 +36,6 @@ enum class TabSwitcherDismissalMode { NONE, NORMAL, INCOGNITO };
// Coordinator for displaying history. // Coordinator for displaying history.
@property(nonatomic, strong) HistoryCoordinator* historyCoordinator; @property(nonatomic, strong) HistoryCoordinator* historyCoordinator;
@property(nonatomic, strong)
SettingsNavigationController* settingsNavigationController;
// The application level component for url loading. Is passed down to // The application level component for url loading. Is passed down to
// browser state level UrlLoadingService instances. // browser state level UrlLoadingService instances.
......
...@@ -32,9 +32,6 @@ class GURL; ...@@ -32,9 +32,6 @@ class GURL;
@property(nonatomic, readonly) DeviceSharingManager* deviceSharingManager; @property(nonatomic, readonly) DeviceSharingManager* deviceSharingManager;
@property(nonatomic, retain) id<TabSwitcher> tabSwitcher; @property(nonatomic, retain) id<TabSwitcher> tabSwitcher;
// The top presented view controller that is not currently being dismissed.
@property(nonatomic, readonly) UIViewController* topPresentedViewController;
// Tab switcher state. // Tab switcher state.
@property(nonatomic, getter=isTabSwitcherActive) BOOL tabSwitcherActive; @property(nonatomic, getter=isTabSwitcherActive) BOOL tabSwitcherActive;
......
...@@ -46,6 +46,7 @@ source_set("scene") { ...@@ -46,6 +46,7 @@ source_set("scene") {
"//ios/chrome/browser/signin", "//ios/chrome/browser/signin",
"//ios/chrome/browser/snapshots", "//ios/chrome/browser/snapshots",
"//ios/chrome/browser/tabs:tabs", "//ios/chrome/browser/tabs:tabs",
"//ios/chrome/browser/ui/authentication",
"//ios/chrome/browser/ui/browser_view", "//ios/chrome/browser/ui/browser_view",
"//ios/chrome/browser/ui/commands:commands", "//ios/chrome/browser/ui/commands:commands",
"//ios/chrome/browser/ui/history", "//ios/chrome/browser/ui/history",
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/app/application_delegate/app_navigation.h"
#import "ios/chrome/app/application_delegate/tab_opening.h" #import "ios/chrome/app/application_delegate/tab_opening.h"
#import "ios/chrome/app/application_delegate/tab_switching.h" #import "ios/chrome/app/application_delegate/tab_switching.h"
#import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/application_commands.h"
...@@ -18,7 +19,8 @@ ...@@ -18,7 +19,8 @@
@protocol MainControllerGuts; @protocol MainControllerGuts;
// The controller object for a scene. Reacts to scene state changes. // The controller object for a scene. Reacts to scene state changes.
@interface SceneController : NSObject <AppURLLoadingServiceDelegate, @interface SceneController : NSObject <AppNavigation,
AppURLLoadingServiceDelegate,
SceneStateObserver, SceneStateObserver,
ApplicationCommands, ApplicationCommands,
TabSwitcherDelegate, TabSwitcherDelegate,
......
...@@ -14,10 +14,11 @@ ...@@ -14,10 +14,11 @@
@class TabModel; @class TabModel;
@protocol SceneControllerGuts namespace ios {
class ChromeBrowserState;
} // namespace ios
- (void)closeSettingsAnimated:(BOOL)animated @protocol SceneControllerGuts
completion:(ProceduralBlock)completion;
- (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion - (void)dismissModalDialogsWithCompletion:(ProceduralBlock)completion
dismissOmnibox:(BOOL)dismissOmnibox; dismissOmnibox:(BOOL)dismissOmnibox;
...@@ -51,6 +52,16 @@ ...@@ -51,6 +52,16 @@
// screen and showing the appropriate BVC. // screen and showing the appropriate BVC.
- (void)finishDismissingTabSwitcher; - (void)finishDismissingTabSwitcher;
#pragma mark - AppNavigation helpers
// Presents a SignedInAccountsViewController for |browserState| on the top view
// controller.
- (void)presentSignedInAccountsViewControllerForBrowserState:
(ios::ChromeBrowserState*)browserState;
// Returns YES if the settings navigation controller exists.
- (BOOL)hasSettingsNavigationController;
@end @end
#endif // IOS_CHROME_BROWSER_UI_MAIN_SCENE_CONTROLLER_GUTS_H_ #endif // IOS_CHROME_BROWSER_UI_MAIN_SCENE_CONTROLLER_GUTS_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