Commit 580ed67a authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Remove Infobar feature flag check for badges logic

Now that Badges logic will be used when in Incognito, it should not be
tied to the Infobar feature flag, which won't be rolled out to 100%
soon.

Bug: 976901
Change-Id: I94ece69646370de01672ba10c2ef15aad60e2fcc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783226
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#693800}
parent 072627d6
......@@ -150,9 +150,7 @@ void AttachTabHelpers(web::WebState* web_state, bool for_prerender) {
SnapshotTabHelper::CreateForWebState(web_state, tab_id);
PagePlaceholderTabHelper::CreateForWebState(web_state);
PrintTabHelper::CreateForWebState(web_state);
if (IsInfobarUIRebootEnabled()) {
InfobarBadgeTabHelper::CreateForWebState(web_state);
}
}
// Allow the embedder to attach tab helpers.
......
......@@ -174,28 +174,24 @@ const int kLocationAuthorizationStatusCount = 5;
[self.omniboxPopupCoordinator start];
// Create BadgeMediator and set the viewController as its consumer.
if (IsInfobarUIRebootEnabled()) {
BadgeButtonActionHandler* actionHandler =
[[BadgeButtonActionHandler alloc] init];
actionHandler.dispatcher =
static_cast<id<InfobarCommands>>(self.dispatcher);
BadgeButtonFactory* buttonFactory =
[[BadgeButtonFactory alloc] initWithActionHandler:actionHandler];
self.badgeViewController =
[[BadgeViewController alloc] initWithButtonFactory:buttonFactory];
[self.viewController addChildViewController:self.badgeViewController];
[self.viewController setBadgeView:self.badgeViewController.view];
[self.badgeViewController
didMoveToParentViewController:self.viewController];
self.badgeMediator =
[[BadgeMediator alloc] initWithConsumer:self.badgeViewController
webStateList:self.webStateList];
_fullscreenBadgeObserver =
std::make_unique<FullscreenUIUpdater>(self.badgeViewController);
FullscreenControllerFactory::GetInstance()
->GetForBrowserState(self.browserState)
->AddObserver(_fullscreenBadgeObserver.get());
}
BadgeButtonActionHandler* actionHandler =
[[BadgeButtonActionHandler alloc] init];
actionHandler.dispatcher = static_cast<id<InfobarCommands>>(self.dispatcher);
BadgeButtonFactory* buttonFactory =
[[BadgeButtonFactory alloc] initWithActionHandler:actionHandler];
self.badgeViewController =
[[BadgeViewController alloc] initWithButtonFactory:buttonFactory];
[self.viewController addChildViewController:self.badgeViewController];
[self.viewController setBadgeView:self.badgeViewController.view];
[self.badgeViewController didMoveToParentViewController:self.viewController];
self.badgeMediator =
[[BadgeMediator alloc] initWithConsumer:self.badgeViewController
webStateList:self.webStateList];
_fullscreenBadgeObserver =
std::make_unique<FullscreenUIUpdater>(self.badgeViewController);
FullscreenControllerFactory::GetInstance()
->GetForBrowserState(self.browserState)
->AddObserver(_fullscreenBadgeObserver.get());
self.mediator = [[LocationBarMediator alloc]
initWithLocationBarModel:[self locationBarModel]];
......@@ -232,11 +228,9 @@ const int kLocationAuthorizationStatusCount = 5;
FullscreenControllerFactory::GetInstance()
->GetForBrowserState(self.browserState)
->RemoveObserver(_fullscreenObserver.get());
if (IsInfobarUIRebootEnabled()) {
FullscreenControllerFactory::GetInstance()
->GetForBrowserState(self.browserState)
->RemoveObserver(_fullscreenBadgeObserver.get());
}
self.started = NO;
}
......
......@@ -166,10 +166,8 @@ const double kHideBadgeViewThreshold = 0.1;
- (void)viewDidLoad {
[super viewDidLoad];
if (IsInfobarUIRebootEnabled()) {
DCHECK(self.badgeView) << "The badge view must be set at this point";
self.locationBarSteadyView.badgeView = self.badgeView;
}
[_locationBarSteadyView.locationButton
addTarget:self
......@@ -206,11 +204,9 @@ const double kHideBadgeViewThreshold = 0.1;
CGFloat alphaValue = fmax((progress - 0.85) / 0.15, 0);
CGFloat scaleValue = 0.79 + 0.21 * progress;
self.locationBarSteadyView.trailingButton.alpha = alphaValue;
if (IsInfobarUIRebootEnabled()) {
BOOL badgeViewShouldCollapse = progress <= kHideBadgeViewThreshold;
[self.locationBarSteadyView
setFullScreenCollapsedMode:badgeViewShouldCollapse];
}
self.locationBarSteadyView.transform =
CGAffineTransformMakeScale(scaleValue, scaleValue);
}
......@@ -293,15 +289,11 @@ const double kHideBadgeViewThreshold = 0.1;
}
- (void)hideSteadyViewBadgeView {
if (IsInfobarUIRebootEnabled()) {
[self.locationBarSteadyView displayBadgeView:NO animated:NO];
}
}
- (void)showSteadyViewBadgeView {
if (IsInfobarUIRebootEnabled()) {
[self.locationBarSteadyView displayBadgeView:YES animated:NO];
}
}
- (void)setEditViewFaded:(BOOL)hidden {
......
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