OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" | 5 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 | 9 |
10 #pragma mark - CRWToolbarContainerView | 10 #pragma mark - CRWToolbarContainerView |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Container view that displays any added toolbars. It is always the top-most | 91 // Container view that displays any added toolbars. It is always the top-most |
92 // subview, and is bottom aligned with the CRWWebControllerContainerView. | 92 // subview, and is bottom aligned with the CRWWebControllerContainerView. |
93 @property(nonatomic, retain, readonly) | 93 @property(nonatomic, retain, readonly) |
94 CRWToolbarContainerView* toolbarContainerView; | 94 CRWToolbarContainerView* toolbarContainerView; |
95 | 95 |
96 @end | 96 @end |
97 | 97 |
98 @implementation CRWWebControllerContainerView | 98 @implementation CRWWebControllerContainerView |
99 | 99 |
100 - (instancetype)init { | |
101 NOTREACHED(); | |
102 return nil; | |
103 } | |
104 | |
105 - (instancetype)initWithFrame:(CGRect)frame { | 100 - (instancetype)initWithFrame:(CGRect)frame { |
106 self = [super initWithFrame:frame]; | 101 self = [super initWithFrame:frame]; |
107 if (self) { | 102 if (self) { |
108 self.backgroundColor = [UIColor whiteColor]; | 103 self.backgroundColor = [UIColor whiteColor]; |
109 self.autoresizingMask = | 104 self.autoresizingMask = |
110 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; | 105 UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; |
111 } | 106 } |
112 return self; | 107 return self; |
113 } | 108 } |
114 | 109 |
| 110 - (instancetype)init { |
| 111 NOTREACHED(); |
| 112 return nil; |
| 113 } |
| 114 |
115 #pragma mark Accessors | 115 #pragma mark Accessors |
116 | 116 |
117 - (void)setToolbarContainerView:(CRWToolbarContainerView*)toolbarContainerView { | 117 - (void)setToolbarContainerView:(CRWToolbarContainerView*)toolbarContainerView { |
118 if (![_toolbarContainerView isEqual:toolbarContainerView]) { | 118 if (![_toolbarContainerView isEqual:toolbarContainerView]) { |
119 [_toolbarContainerView removeFromSuperview]; | 119 [_toolbarContainerView removeFromSuperview]; |
120 _toolbarContainerView.reset([toolbarContainerView retain]); | 120 _toolbarContainerView.reset([toolbarContainerView retain]); |
121 [self addSubview:_toolbarContainerView]; | 121 [self addSubview:_toolbarContainerView]; |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 else | 170 else |
171 self.toolbarContainerView = nil; | 171 self.toolbarContainerView = nil; |
172 } | 172 } |
173 | 173 |
174 - (void)removeAllToolbars { | 174 - (void)removeAllToolbars { |
175 // Resetting the property will remove the toolbars from the hierarchy. | 175 // Resetting the property will remove the toolbars from the hierarchy. |
176 self.toolbarContainerView = nil; | 176 self.toolbarContainerView = nil; |
177 } | 177 } |
178 | 178 |
179 @end | 179 @end |
OLD | NEW |