| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/cocoa/infobars/infobar_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/infobar_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #import "chrome/browser/ui/cocoa/animatable_view.h" | 10 #import "chrome/browser/ui/cocoa/animatable_view.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 [image_ removeFromSuperview]; | 68 [image_ removeFromSuperview]; |
| 69 image_ = nil; | 69 image_ = nil; |
| 70 [labelPlaceholder_ setFrame:labelFrame]; | 70 [labelPlaceholder_ setFrame:labelFrame]; |
| 71 } | 71 } |
| 72 [self initializeLabel]; | 72 [self initializeLabel]; |
| 73 | 73 |
| 74 [self addAdditionalControls]; | 74 [self addAdditionalControls]; |
| 75 | 75 |
| 76 // Infobars are drawn a little taller, so have to move its controls to keep | 76 // Infobars are drawn a little taller, so have to move its controls to keep |
| 77 // them centered. | 77 // them centered. |
| 78 // TODO(ellyjones): Remove this constant. | 78 CGFloat heightDelta = InfoBarContainerDelegate::kDefaultBarTargetHeightMd - |
| 79 CGFloat heightDelta = 2; | 79 InfoBarContainerDelegate::kDefaultBarTargetHeight; |
| 80 for (NSView* nextSubview in [infoBarView_ subviews]) { | 80 for (NSView* nextSubview in [infoBarView_ subviews]) { |
| 81 NSRect frame = [nextSubview frame]; | 81 NSRect frame = [nextSubview frame]; |
| 82 frame.origin.y += heightDelta / 2; | 82 frame.origin.y += heightDelta / 2; |
| 83 [nextSubview setFrame:frame]; | 83 [nextSubview setFrame:frame]; |
| 84 } | 84 } |
| 85 | 85 |
| 86 [infoBarView_ setInfobarType:[self delegate]->GetInfoBarType()]; | 86 [infoBarView_ setInfobarType:[self delegate]->GetInfoBarType()]; |
| 87 [infoBarView_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; | 87 [infoBarView_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; |
| 88 } | 88 } |
| 89 | 89 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 [newLabel setAutoresizingMask:[labelPlaceholder_ autoresizingMask]]; | 193 [newLabel setAutoresizingMask:[labelPlaceholder_ autoresizingMask]]; |
| 194 [[labelPlaceholder_ superview] | 194 [[labelPlaceholder_ superview] |
| 195 replaceSubview:labelPlaceholder_ with:newLabel]; | 195 replaceSubview:labelPlaceholder_ with:newLabel]; |
| 196 labelPlaceholder_ = nil; // Now released. | 196 labelPlaceholder_ = nil; // Now released. |
| 197 [newLabel setDelegate:self]; | 197 [newLabel setDelegate:self]; |
| 198 | 198 |
| 199 label_.reset(newLabel.release()); | 199 label_.reset(newLabel.release()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 @end | 202 @end |
| OLD | NEW |