Commit fc968b4a authored by sczs's avatar sczs Committed by Commit Bot

[ios] Removes position parameter from InfobarContainerConsumer.

This parameter is not really needed since position is always the count
of current Infobars, meaning it was always adding the Infobars in the
last position:
https://cs.chromium.org/chromium/src/components/infobars/core/
infobar_container.cc?type=cs&q=OnInfoBarAdded&sq=package:chromium&g=0&l=98

Also, since we now have 2 InfobarContainers a single one of them can't
keep track of how many Infobars are presented, for that reason the
DCHECK on legacy_infobar_container is no longer relevant.

Bug: 911864
Change-Id: I47909d40af15f40d80f822de31f865fb732c8047
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1574289
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652575}
parent 24530db6
...@@ -73,8 +73,7 @@ ...@@ -73,8 +73,7 @@
@end @end
@implementation FakeInfobarContainerCoordinator @implementation FakeInfobarContainerCoordinator
- (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate - (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate {
position:(NSInteger)position {
self.infobarCoordinator = static_cast<InfobarCoordinator*>(infoBarDelegate); self.infobarCoordinator = static_cast<InfobarCoordinator*>(infoBarDelegate);
self.infobarCoordinator.baseViewController = self.baseViewController; self.infobarCoordinator.baseViewController = self.baseViewController;
[self.infobarCoordinator start]; [self.infobarCoordinator start];
......
...@@ -33,9 +33,9 @@ void InfoBarContainerIOS::PlatformSpecificAddInfoBar(infobars::InfoBar* infobar, ...@@ -33,9 +33,9 @@ void InfoBarContainerIOS::PlatformSpecificAddInfoBar(infobars::InfoBar* infobar,
// Only InfobarUIReboot Infobars should be presented using the non legacy // Only InfobarUIReboot Infobars should be presented using the non legacy
// consumer. // consumer.
DCHECK(IsInfobarUIRebootEnabled()); DCHECK(IsInfobarUIRebootEnabled());
[consumer_ addInfoBarWithDelegate:delegate position:position]; [consumer_ addInfoBarWithDelegate:delegate];
} else { } else {
[legacyConsumer_ addInfoBarWithDelegate:delegate position:position]; [legacyConsumer_ addInfoBarWithDelegate:delegate];
} }
} }
......
...@@ -12,10 +12,8 @@ ...@@ -12,10 +12,8 @@
// Protocol to communicate with the Infobar container. // Protocol to communicate with the Infobar container.
@protocol InfobarContainerConsumer @protocol InfobarContainerConsumer
// Adds |infoBarDelegate|'s Infobar to the InfobarContainer at position // Adds |infoBarDelegate|'s Infobar to the InfobarContainer.
// |position|. - (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate;
- (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate
position:(NSInteger)position;
// Sets the Infobar container user interaction to |enabled|. // Sets the Infobar container user interaction to |enabled|.
- (void)setUserInteractionEnabled:(BOOL)enabled; - (void)setUserInteractionEnabled:(BOOL)enabled;
......
...@@ -155,8 +155,7 @@ const double kBannerPresentationDurationInSeconds = 6.0; ...@@ -155,8 +155,7 @@ const double kBannerPresentationDurationInSeconds = 6.0;
#pragma mark - InfobarConsumer #pragma mark - InfobarConsumer
- (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate - (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate {
position:(NSInteger)position {
DCHECK(IsInfobarUIRebootEnabled()); DCHECK(IsInfobarUIRebootEnabled());
InfobarCoordinator* infobarCoordinator = InfobarCoordinator* infobarCoordinator =
static_cast<InfobarCoordinator*>(infoBarDelegate); static_cast<InfobarCoordinator*>(infoBarDelegate);
......
...@@ -79,11 +79,9 @@ const CGFloat kAlphaChangeAnimationDuration = 0.35; ...@@ -79,11 +79,9 @@ const CGFloat kAlphaChangeAnimationDuration = 0.35;
#pragma mark - InfobarConsumer #pragma mark - InfobarConsumer
- (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate - (void)addInfoBarWithDelegate:(id<InfobarUIDelegate>)infoBarDelegate {
position:(NSInteger)position {
DCHECK_LE(static_cast<NSUInteger>(position), [[self.view subviews] count]);
UIView* infoBarView = infoBarDelegate.view; UIView* infoBarView = infoBarDelegate.view;
[self.view insertSubview:infoBarView atIndex:position]; [self.view addSubview:infoBarView];
infoBarView.translatesAutoresizingMaskIntoConstraints = NO; infoBarView.translatesAutoresizingMaskIntoConstraints = NO;
[NSLayoutConstraint activateConstraints:@[ [NSLayoutConstraint activateConstraints:@[
[infoBarView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor], [infoBarView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor],
......
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