Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: ios/chrome/browser/infobars/infobar_container_ios.mm

Issue 2593103002: Remove ChromeBrowserProvider::SetUIViewAlphaWithAnimation(). (Closed)
Patch Set: Restore #include removed by mistake. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/infobars/BUILD.gn ('k') | ios/public/provider/chrome/browser/chrome_browser_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/infobars/infobar_container_ios.mm
diff --git a/ios/chrome/browser/infobars/infobar_container_ios.mm b/ios/chrome/browser/infobars/infobar_container_ios.mm
index 2be86c2c06d3d8ebcf6b1063795c604a705321f3..9293c949cc4b930376d348a9e1ba6d4e9a15e996 100644
--- a/ios/chrome/browser/infobars/infobar_container_ios.mm
+++ b/ios/chrome/browser/infobars/infobar_container_ios.mm
@@ -8,15 +8,35 @@
#import <UIKit/UIKit.h>
#include "base/logging.h"
-#include "base/threading/thread_task_runner_handle.h"
#include "ios/chrome/browser/infobars/infobar.h"
#include "ios/chrome/browser/infobars/infobar_container_view.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/chrome/common/material_timing.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
+namespace {
+void SetViewAlphaWithAnimation(UIView* view, float alpha) {
+ CGFloat oldAlpha = [view alpha];
+ if (oldAlpha > 0 && alpha == 0) {
+ [view setUserInteractionEnabled:NO];
+ }
+ [UIView cr_transitionWithView:view
+ duration:ios::material::kDuration3
+ curve:ios::material::CurveEaseInOut
+ options:0
+ animations:^{
+ [view setAlpha:alpha];
+ }
+ completion:^(BOOL) {
+ if (oldAlpha == 0 && alpha > 0) {
+ [view setUserInteractionEnabled:YES];
+ };
+ }];
+}
+} // namespace
+
InfoBarContainerIOS::InfoBarContainerIOS(
infobars::InfoBarContainer::Delegate* delegate)
: InfoBarContainer(delegate), delegate_(delegate) {
@@ -52,11 +72,6 @@ void InfoBarContainerIOS::PlatformSpecificRemoveInfoBar(
// is added.
if (infobar->total_height() == 0 && delegate_)
delegate_->InfoBarContainerStateChanged(false);
-
- // TODO(rohitrao, jif): [Merge 239355] Upstream InfoBarContainer deletes the
- // infobar. Avoid deleting it here.
- // crbug.com/327290
- // base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, infobar_ios);
}
void InfoBarContainerIOS::PlatformSpecificInfoBarStateChanged(
@@ -66,11 +81,9 @@ void InfoBarContainerIOS::PlatformSpecificInfoBarStateChanged(
}
void InfoBarContainerIOS::SuspendInfobars() {
- ios::GetChromeBrowserProvider()->SetUIViewAlphaWithAnimation(container_view_,
- 0);
+ SetViewAlphaWithAnimation(container_view_, 0);
}
void InfoBarContainerIOS::RestoreInfobars() {
- ios::GetChromeBrowserProvider()->SetUIViewAlphaWithAnimation(container_view_,
- 1);
+ SetViewAlphaWithAnimation(container_view_, 1);
}
« no previous file with comments | « ios/chrome/browser/infobars/BUILD.gn ('k') | ios/public/provider/chrome/browser/chrome_browser_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698