Commit 899fc1d7 authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Make isFullScreen a property in BadgeItem

Bug: 976901
Change-Id: Ie956e580d406832b559815ca7a0fc8dabc2c30ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1830299
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701354}
parent 3ad7bd04
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
@synthesize tappable = _tappable; @synthesize tappable = _tappable;
// Synthesized from BadgeItem. // Synthesized from BadgeItem.
@synthesize badgeState = _badgeState; @synthesize badgeState = _badgeState;
// Synthesized from BadgeItem.
@synthesize fullScreen = _fullScreen;
- (instancetype)initWithInfobarType:(InfobarType)type { - (instancetype)initWithInfobarType:(InfobarType)type {
self = [super init]; self = [super init];
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
_tappable = YES; _tappable = YES;
_infobarType = type; _infobarType = type;
_badgeState = BadgeStateNone; _badgeState = BadgeStateNone;
_fullScreen = NO;
} }
return self; return self;
} }
...@@ -47,8 +50,4 @@ ...@@ -47,8 +50,4 @@
} }
} }
- (BOOL)isFullScreen {
return NO;
}
@end @end
...@@ -27,7 +27,7 @@ typedef NS_OPTIONS(NSUInteger, BadgeState) { ...@@ -27,7 +27,7 @@ typedef NS_OPTIONS(NSUInteger, BadgeState) {
- (BadgeType)badgeType; - (BadgeType)badgeType;
// Whether the badge should be displayed in the fullScreenBadge position. If // Whether the badge should be displayed in the fullScreenBadge position. If
// YES, it will be displayed in both FullScreen and non FullScreen. // YES, it will be displayed in both FullScreen and non FullScreen.
- (BOOL)isFullScreen; @property(nonatomic, assign, readonly) BOOL fullScreen;
// Some badges may not be tappable if there is no action associated with it. // Some badges may not be tappable if there is no action associated with it.
@property(nonatomic, assign, readonly, getter=isTappable) BOOL tappable; @property(nonatomic, assign, readonly, getter=isTappable) BOOL tappable;
// The BadgeState of the badge. // The BadgeState of the badge.
......
...@@ -145,7 +145,7 @@ const int kMinimumNonFullScreenBadgesForOverflow = 2; ...@@ -145,7 +145,7 @@ const int kMinimumNonFullScreenBadgesForOverflow = 2;
[[NSMutableArray alloc] init]; [[NSMutableArray alloc] init];
// Get all non-fullscreen badges. // Get all non-fullscreen badges.
for (id<BadgeItem> item in self.badges) { for (id<BadgeItem> item in self.badges) {
if (![item isFullScreen]) { if (!item.fullScreen) {
[popupMenuBadges addObject:item]; [popupMenuBadges addObject:item];
} }
} }
...@@ -195,7 +195,7 @@ const int kMinimumNonFullScreenBadgesForOverflow = 2; ...@@ -195,7 +195,7 @@ const int kMinimumNonFullScreenBadgesForOverflow = 2;
// displayedBadge if there are multiple badges. // displayedBadge if there are multiple badges.
id<BadgeItem> presentingBadge; id<BadgeItem> presentingBadge;
for (id<BadgeItem> item in self.badges) { for (id<BadgeItem> item in self.badges) {
if ([item isFullScreen]) { if (item.fullScreen) {
fullScreenBadge = item; fullScreenBadge = item;
} else { } else {
if (item.badgeState == BadgeStatePresented) { if (item.badgeState == BadgeStatePresented) {
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
@synthesize tappable = _tappable; @synthesize tappable = _tappable;
// Sythesized from protocol. // Sythesized from protocol.
@synthesize badgeState = _badgeState; @synthesize badgeState = _badgeState;
// Synthesized from BadgeItem.
@synthesize fullScreen = _fullScreen;
- (instancetype)initWithBadgeType:(BadgeType)badgeType { - (instancetype)initWithBadgeType:(BadgeType)badgeType {
self = [super init]; self = [super init];
...@@ -29,6 +31,7 @@ ...@@ -29,6 +31,7 @@
_badgeType = badgeType; _badgeType = badgeType;
_tappable = NO; _tappable = NO;
_badgeState = BadgeStateNone; _badgeState = BadgeStateNone;
_fullScreen = badgeType == BadgeType::kBadgeTypeIncognito;
} }
return self; return self;
} }
...@@ -39,8 +42,4 @@ ...@@ -39,8 +42,4 @@
return _badgeType; return _badgeType;
} }
- (BOOL)isFullScreen {
return self.badgeType == BadgeType::kBadgeTypeIncognito;
}
@end @end
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
@synthesize tappable = _tappable; @synthesize tappable = _tappable;
// Synthesized from protocol. // Synthesized from protocol.
@synthesize badgeState = _badgeState; @synthesize badgeState = _badgeState;
// Synthesized from BadgeItem.
@synthesize fullScreen = _fullScreen;
- (instancetype)initWithBadgeType:(BadgeType)badgeType { - (instancetype)initWithBadgeType:(BadgeType)badgeType {
self = [super init]; self = [super init];
...@@ -29,14 +31,9 @@ ...@@ -29,14 +31,9 @@
_badgeType = badgeType; _badgeType = badgeType;
_tappable = YES; _tappable = YES;
_badgeState = BadgeStateNone; _badgeState = BadgeStateNone;
_fullScreen = NO;
} }
return self; return self;
} }
#pragma mark - BadgeItem
- (BOOL)isFullScreen {
return NO;
}
@end @end
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