Commit 2780d02e authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Add Browser as a public assignable property to InfobarCoordinator

FullscreenController will soon be Browser-scoped, so InfobarCoordinator
will need its browser property assignable.

Bug: 790886
Change-Id: Ifcde830dd331e1561217b102343749ae4db6779b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2123319
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755382}
parent 71f2c4f5
......@@ -24,6 +24,7 @@ source_set("coordinators") {
"//ios/chrome/app/strings:ios_strings_grit",
"//ios/chrome/browser/infobars:public",
"//ios/chrome/browser/infobars:public",
"//ios/chrome/browser/main:public",
"//ios/chrome/browser/passwords:infobar_delegates",
"//ios/chrome/browser/passwords:public",
"//ios/chrome/browser/translate:public",
......
......@@ -87,10 +87,10 @@ enum class InfobarBannerPresentationState;
// Coordinator doesn't support a badge.
@property(nonatomic, weak) id<InfobarBadgeUIDelegate> badgeDelegate;
// The ChromeBrowserState owned by the Coordinator.
// The Browser owned by the Coordinator.
// TODO(crbug.com/927064): Once we create the coordinators in the UI Hierarchy
// browserState will be set on init.
@property(nonatomic, assign) ChromeBrowserState* browserState;
// browser will be set on init.
@property(nonatomic, assign, readwrite) Browser* browser;
// The WebState that the InfobarCoordinator is associated with. Can be nil.
@property(nonatomic, assign) web::WebState* webState;
......
......@@ -6,6 +6,7 @@
#import "ios/chrome/browser/ui/infobars/coordinators/infobar_coordinator+subclassing.h"
#include "base/mac/foundation_util.h"
#import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/ui/fullscreen/animated_scoped_fullscreen_disabler.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
......@@ -59,7 +60,7 @@
// Synthesize since readonly property from superclass is changed to readwrite.
@synthesize baseViewController = _baseViewController;
// Synthesize since readonly property from superclass is changed to readwrite.
@synthesize browserState = _browserState;
@synthesize browser = _browser;
// Property defined in InfobarUIDelegate.
@synthesize delegate = _delegate;
// Property defined in InfobarUIDelegate.
......@@ -93,7 +94,7 @@
- (void)presentInfobarBannerAnimated:(BOOL)animated
completion:(ProceduralBlock)completion {
DCHECK(self.browserState);
DCHECK(self.browser);
DCHECK(self.baseViewController);
DCHECK(self.bannerViewController);
DCHECK(self.started);
......@@ -112,7 +113,8 @@
} else {
_animatedFullscreenDisabler =
std::make_unique<AnimatedScopedFullscreenDisabler>(
FullscreenController::FromBrowserState(self.browserState));
FullscreenController::FromBrowserState(
self.browser->GetBrowserState()));
}
_animatedFullscreenDisabler->StartAnimation();
......
......@@ -220,7 +220,7 @@
// doing so might cause undefined behavior since no badge was added.
if (infobarCoordinator.hasBadge)
infobarCoordinator.badgeDelegate = self.mediator;
infobarCoordinator.browserState = self.browser->GetBrowserState();
infobarCoordinator.browser = self.browser;
infobarCoordinator.webState =
self.browser->GetWebStateList()->GetActiveWebState();
infobarCoordinator.baseViewController = self.baseViewController;
......
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