Commit c7e9db3c authored by edchin's avatar edchin Committed by Commit Bot

[ios] Remove unused InfobarBadgeButton

This is dead code.

Change-Id: I587671bc66fe30fec8d597be173f1f16f35aec1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2163079Reviewed-by: default avatarChris Lu <thegreenfrog@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762844}
parent 38e17e6d
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("badge") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"infobar_badge_button.h",
"infobar_badge_button.mm",
]
deps = [
"//ios/chrome/browser/ui/elements",
"//ios/chrome/browser/ui/util",
]
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_INFOBARS_BADGE_INFOBAR_BADGE_BUTTON_H_
#define IOS_CHROME_BROWSER_UI_INFOBARS_BADGE_INFOBAR_BADGE_BUTTON_H_
#import "ios/chrome/browser/ui/elements/extended_touch_target_button.h"
// A button for an Infobar that contains a badge image.
@interface InfobarBadgeButton : ExtendedTouchTargetButton
// Sets the badge color to blue if |active| is YES, light gray if |active| is
// NO. Will animate change if |animated| is YES.
- (void)setActive:(BOOL)active animated:(BOOL)animated;
// Displays the badge button if |display| is YES, shows it if |display| is NO.
// Will animate change if |animated| is YES.
- (void)displayBadge:(BOOL)display animated:(BOOL)animated;
@end
#endif // IOS_CHROME_BROWSER_UI_INFOBARS_BADGE_INFOBAR_BADGE_BUTTON_H_
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/infobars/badge/infobar_badge_button.h"
#import "ios/chrome/browser/ui/util/uikit_ui_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Duration of button animations, in seconds.
const CGFloat kButtonAnimationDuration = 0.2;
// Edge insets of button.
const CGFloat kButtonEdgeInset = 6;
// Tint color of the button in an active state.
const CGFloat kActiveTintColor = 0x1A73E8;
// To achieve a circular corner radius, divide length of a side by 2.
const CGFloat kCircularCornerRadiusDivisor = 2.0;
// Alpha value of button in an inactive state.
const CGFloat kButtonInactiveAlpha = 0.38;
} // namespace
@interface InfobarBadgeButton ()
// Indicates whether the button has already been properly configured.
@property(nonatomic, assign) BOOL didSetupSubviews;
@end
@implementation InfobarBadgeButton
- (void)willMoveToSuperview:(UIView*)newSuperview {
if (!self.didSetupSubviews) {
self.didSetupSubviews = YES;
[self
setImage:[[UIImage imageNamed:@"infobar_passwords_icon"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]
forState:UIControlStateNormal];
self.imageView.contentMode = UIViewContentModeScaleToFill;
self.imageEdgeInsets = UIEdgeInsetsMake(kButtonEdgeInset, kButtonEdgeInset,
kButtonEdgeInset, kButtonEdgeInset);
}
[super willMoveToSuperview:newSuperview];
}
- (void)layoutSubviews {
[super layoutSubviews];
self.layer.cornerRadius =
self.bounds.size.height / kCircularCornerRadiusDivisor;
}
- (void)setActive:(BOOL)active animated:(BOOL)animated {
void (^changeTintColor)() = ^{
self.tintColor = active ? UIColorFromRGB(kActiveTintColor)
: [UIColor colorWithWhite:0
alpha:kButtonInactiveAlpha];
};
if (animated) {
[UIView animateWithDuration:kButtonAnimationDuration
animations:^{
changeTintColor();
}];
} else {
changeTintColor();
}
}
- (void)displayBadge:(BOOL)display animated:(BOOL)animated {
void (^changeBadgeDisplay)() = ^{
self.hidden = !display;
};
if (animated) {
// Shrink badge to nothing before animating it's expansion back to original
// scale.
self.transform = CGAffineTransformMakeScale(0, 0);
changeBadgeDisplay();
[UIView animateWithDuration:kButtonAnimationDuration
animations:^{
self.transform = CGAffineTransformIdentity;
}];
} else {
changeBadgeDisplay();
}
}
@end
...@@ -57,7 +57,6 @@ source_set("location_bar") { ...@@ -57,7 +57,6 @@ source_set("location_bar") {
"//ios/chrome/browser/ui/fullscreen:feature_flags", "//ios/chrome/browser/ui/fullscreen:feature_flags",
"//ios/chrome/browser/ui/fullscreen:ui", "//ios/chrome/browser/ui/fullscreen:ui",
"//ios/chrome/browser/ui/infobars:feature_flags", "//ios/chrome/browser/ui/infobars:feature_flags",
"//ios/chrome/browser/ui/infobars/badge",
"//ios/chrome/browser/ui/ntp:util", "//ios/chrome/browser/ui/ntp:util",
"//ios/chrome/browser/ui/omnibox:omnibox", "//ios/chrome/browser/ui/omnibox:omnibox",
"//ios/chrome/browser/ui/omnibox:omnibox_internal", "//ios/chrome/browser/ui/omnibox:omnibox_internal",
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "ios/chrome/browser/ui/infobars/badge/infobar_badge_button.h"
// A color scheme used for the steady view elements. // A color scheme used for the steady view elements.
@interface LocationBarSteadyViewColorScheme : NSObject @interface LocationBarSteadyViewColorScheme : NSObject
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#import "ios/chrome/browser/ui/commands/infobar_commands.h" #import "ios/chrome/browser/ui/commands/infobar_commands.h"
#import "ios/chrome/browser/ui/commands/load_query_commands.h" #import "ios/chrome/browser/ui/commands/load_query_commands.h"
#import "ios/chrome/browser/ui/fullscreen/fullscreen_animator.h" #import "ios/chrome/browser/ui/fullscreen/fullscreen_animator.h"
#import "ios/chrome/browser/ui/infobars/badge/infobar_badge_button.h"
#import "ios/chrome/browser/ui/infobars/infobar_feature.h" #import "ios/chrome/browser/ui/infobars/infobar_feature.h"
#include "ios/chrome/browser/ui/location_bar/location_bar_steady_view.h" #include "ios/chrome/browser/ui/location_bar/location_bar_steady_view.h"
#import "ios/chrome/browser/ui/orchestrator/location_bar_offset_provider.h" #import "ios/chrome/browser/ui/orchestrator/location_bar_offset_provider.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