OLD | NEW |
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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" | 9 #import "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" |
10 | 10 |
11 @interface InfoBarController () { | 11 @interface InfoBarController () { |
12 base::scoped_nsobject<UIView<InfoBarViewProtocol>> _infoBarView; | 12 base::scoped_nsobject<UIView<InfoBarViewProtocol>> _infoBarView; |
13 } | 13 } |
14 @end | 14 @end |
15 | 15 |
16 @implementation InfoBarController | 16 @implementation InfoBarController |
17 @synthesize delegate = _delegate; | 17 @synthesize delegate = _delegate; |
18 | 18 |
19 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { | 19 - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate { |
20 self = [super init]; | 20 self = [super init]; |
21 if (self) { | 21 if (self) { |
22 DCHECK(delegate); | 22 DCHECK(delegate); |
23 _delegate = delegate; | 23 _delegate = delegate; |
24 } | 24 } |
25 return self; | 25 return self; |
26 } | 26 } |
27 | 27 |
| 28 - (instancetype)init { |
| 29 NOTREACHED(); |
| 30 return nil; |
| 31 } |
| 32 |
28 - (void)dealloc { | 33 - (void)dealloc { |
29 [_infoBarView removeFromSuperview]; | 34 [_infoBarView removeFromSuperview]; |
30 [super dealloc]; | 35 [super dealloc]; |
31 } | 36 } |
32 | 37 |
33 - (int)barHeight { | 38 - (int)barHeight { |
34 return CGRectGetHeight([_infoBarView frame]); | 39 return CGRectGetHeight([_infoBarView frame]); |
35 } | 40 } |
36 | 41 |
37 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate | 42 - (void)layoutForDelegate:(infobars::InfoBarDelegate*)delegate |
(...skipping 21 matching lines...) Expand all Loading... |
59 - (void)removeView { | 64 - (void)removeView { |
60 [_infoBarView removeFromSuperview]; | 65 [_infoBarView removeFromSuperview]; |
61 } | 66 } |
62 | 67 |
63 - (void)detachView { | 68 - (void)detachView { |
64 [_infoBarView resetDelegate]; | 69 [_infoBarView resetDelegate]; |
65 _delegate = nullptr; | 70 _delegate = nullptr; |
66 } | 71 } |
67 | 72 |
68 @end | 73 @end |
OLD | NEW |