| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/chrome/browser/infobars/infobar_container_view.h" | 5 #import "ios/chrome/browser/infobars/infobar_container_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ios/chrome/browser/infobars/infobar.h" | 8 #include "ios/chrome/browser/infobars/infobar.h" |
| 9 #include "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" | 9 #include "ios/public/provider/chrome/browser/ui/infobar_view_protocol.h" |
| 10 #include "ui/base/device_form_factor.h" | 10 #include "ui/base/device_form_factor.h" |
| 11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
| 12 @implementation InfoBarContainerView | 16 @implementation InfoBarContainerView |
| 13 | 17 |
| 14 - (void)addInfoBar:(InfoBarIOS*)infoBarIOS position:(NSInteger)position { | 18 - (void)addInfoBar:(InfoBarIOS*)infoBarIOS position:(NSInteger)position { |
| 15 DCHECK_LE((NSUInteger)position, [[self subviews] count]); | 19 DCHECK_LE((NSUInteger)position, [[self subviews] count]); |
| 16 CGRect containerBounds = [self bounds]; | 20 CGRect containerBounds = [self bounds]; |
| 17 infoBarIOS->Layout(containerBounds); | 21 infoBarIOS->Layout(containerBounds); |
| 18 UIView* view = infoBarIOS->view(); | 22 UIView* view = infoBarIOS->view(); |
| 19 [self insertSubview:view atIndex:position]; | 23 [self insertSubview:view atIndex:position]; |
| 20 } | 24 } |
| 21 | 25 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 48 | 52 |
| 49 - (CGFloat)topmostVisibleInfoBarHeight { | 53 - (CGFloat)topmostVisibleInfoBarHeight { |
| 50 for (UIView<InfoBarViewProtocol>* view in | 54 for (UIView<InfoBarViewProtocol>* view in |
| 51 [self.subviews reverseObjectEnumerator]) { | 55 [self.subviews reverseObjectEnumerator]) { |
| 52 return [view sizeThatFits:self.frame.size].height; | 56 return [view sizeThatFits:self.frame.size].height; |
| 53 } | 57 } |
| 54 return 0; | 58 return 0; |
| 55 } | 59 } |
| 56 | 60 |
| 57 @end | 61 @end |
| OLD | NEW |