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

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

Issue 1161243002: Fixit: Cleanup of InfoBarController. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding mising forward declaration. Created 5 years, 7 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
Index: ios/chrome/browser/infobars/infobar_controller.mm
diff --git a/ios/chrome/browser/infobars/infobar_controller.mm b/ios/chrome/browser/infobars/infobar_controller.mm
index 2ea5cf6851e528b2b7349da6e276fad2f0b4d0aa..594f0f325ad8da0bf8c6a6afb9420e17b44f7118 100644
--- a/ios/chrome/browser/infobars/infobar_controller.mm
+++ b/ios/chrome/browser/infobars/infobar_controller.mm
@@ -4,52 +4,65 @@
#include "ios/chrome/browser/infobars/infobar_controller.h"
-#include "base/strings/sys_string_conversions.h"
-#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h"
-#include "ui/gfx/image/image.h"
+
+@interface InfoBarController () {
+ base::scoped_nsobject<UIView<InfoBarViewProtocol>> _infoBarView;
+}
+@end
@implementation InfoBarController
+@synthesize delegate = _delegate;
- (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate {
self = [super init];
if (self) {
DCHECK(delegate);
- delegate_ = delegate;
+ _delegate = delegate;
}
return self;
}
- (void)dealloc {
- [infoBarView_ removeFromSuperview];
+ [_infoBarView removeFromSuperview];
[super dealloc];
}
- (int)barHeight {
- return CGRectGetHeight([infoBarView_ frame]);
+ return CGRectGetHeight([_infoBarView frame]);
}
- (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate
frame:(CGRect)bounds {
+ DCHECK(!_infoBarView);
+ _infoBarView = [self viewForDelegate:delegate frame:bounds];
+}
+
+- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>)
+ viewForDelegate:(infobars::InfoBarDelegate*)delegate
+ frame:(CGRect)bounds {
// Must be overriden in subclasses.
NOTREACHED();
+ return _infoBarView;
}
- (void)onHeightsRecalculated:(int)newHeight {
- [infoBarView_ setVisibleHeight:newHeight];
+ [_infoBarView setVisibleHeight:newHeight];
}
-- (UIView*)view {
- return infoBarView_;
+- (UIView<InfoBarViewProtocol>*)view {
+ return _infoBarView;
}
- (void)removeView {
- [infoBarView_ removeFromSuperview];
+ [_infoBarView removeFromSuperview];
}
- (void)detachView {
- [infoBarView_ resetDelegate];
- delegate_ = nullptr;
+ [_infoBarView resetDelegate];
+ _delegate = nullptr;
}
@end
« no previous file with comments | « ios/chrome/browser/infobars/infobar_controller.h ('k') | ios/chrome/browser/translate/after_translate_infobar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698