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

Side by Side Diff: ios/chrome/browser/infobars/infobar_controller.mm

Issue 2592113002: Remove legacy InfoBarViewProtocol. (Closed)
Patch Set: Rebase. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/browser/infobars/infobar_controller.h" 5 #include "ios/chrome/browser/infobars/infobar_controller.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "ios/chrome/browser/ui/infobars/infobar_view_protocol.h" 10 #import "ios/chrome/browser/ui/infobars/infobar_view.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc) 12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support." 13 #error "This file requires ARC support."
14 #endif 14 #endif
15 15
16 @interface InfoBarController () { 16 @interface InfoBarController () {
17 UIView<InfoBarViewProtocol>* _infoBarView; 17 InfoBarView* _infoBarView;
18 } 18 }
19 @end 19 @end
20 20
21 @implementation InfoBarController 21 @implementation InfoBarController
22 @synthesize delegate = _delegate; 22 @synthesize delegate = _delegate;
23 23
24 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { 24 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate {
25 self = [super init]; 25 self = [super init];
26 if (self) { 26 if (self) {
27 DCHECK(delegate); 27 DCHECK(delegate);
(...skipping 14 matching lines...) Expand all
42 - (int)barHeight { 42 - (int)barHeight {
43 return CGRectGetHeight([_infoBarView frame]); 43 return CGRectGetHeight([_infoBarView frame]);
44 } 44 }
45 45
46 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate 46 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate
47 frame:(CGRect)bounds { 47 frame:(CGRect)bounds {
48 DCHECK(!_infoBarView); 48 DCHECK(!_infoBarView);
49 _infoBarView = [self viewForDelegate:delegate frame:bounds]; 49 _infoBarView = [self viewForDelegate:delegate frame:bounds];
50 } 50 }
51 51
52 - (UIView<InfoBarViewProtocol>*)viewForDelegate: 52 - (InfoBarView*)viewForDelegate:(infobars::InfoBarDelegate*)delegate
53 (infobars::InfoBarDelegate*)delegate 53 frame:(CGRect)bounds {
54 frame:(CGRect)bounds {
55 // Must be overriden in subclasses. 54 // Must be overriden in subclasses.
56 NOTREACHED(); 55 NOTREACHED();
57 return _infoBarView; 56 return _infoBarView;
58 } 57 }
59 58
60 - (void)onHeightsRecalculated:(int)newHeight { 59 - (void)onHeightsRecalculated:(int)newHeight {
61 [_infoBarView setVisibleHeight:newHeight]; 60 [_infoBarView setVisibleHeight:newHeight];
62 } 61 }
63 62
64 - (UIView<InfoBarViewProtocol>*)view { 63 - (InfoBarView*)view {
65 return _infoBarView; 64 return _infoBarView;
66 } 65 }
67 66
68 - (void)removeView { 67 - (void)removeView {
69 [_infoBarView removeFromSuperview]; 68 [_infoBarView removeFromSuperview];
70 } 69 }
71 70
72 - (void)detachView { 71 - (void)detachView {
73 [_infoBarView resetDelegate]; 72 [_infoBarView resetDelegate];
74 _delegate = nullptr; 73 _delegate = nullptr;
75 } 74 }
76 75
77 @end 76 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698