| 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/logging.h" // for NOTREACHED() | 7 #include "base/logging.h" // for NOTREACHED() |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 owner_ = owner; | 59 owner_ = owner; |
| 60 } | 60 } |
| 61 return self; | 61 return self; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // All infobars have an icon, so we set up the icon in the base class | 64 // All infobars have an icon, so we set up the icon in the base class |
| 65 // awakeFromNib. | 65 // awakeFromNib. |
| 66 - (void)awakeFromNib { | 66 - (void)awakeFromNib { |
| 67 DCHECK(delegate_); | 67 DCHECK(delegate_); |
| 68 if (delegate_->GetIcon()) { | 68 if (delegate_->GetIcon()) { |
| 69 [image_ setImage:*(delegate_->GetIcon())]; | 69 [image_ setImage:delegate_->GetIcon()->ToNSImage()]; |
| 70 } else { | 70 } else { |
| 71 // No icon, remove it from the view and grow the textfield to include the | 71 // No icon, remove it from the view and grow the textfield to include the |
| 72 // space. | 72 // space. |
| 73 NSRect imageFrame = [image_ frame]; | 73 NSRect imageFrame = [image_ frame]; |
| 74 NSRect labelFrame = [labelPlaceholder_ frame]; | 74 NSRect labelFrame = [labelPlaceholder_ frame]; |
| 75 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); | 75 labelFrame.size.width += NSMinX(imageFrame) - NSMinX(labelFrame); |
| 76 labelFrame.origin.x = imageFrame.origin.x; | 76 labelFrame.origin.x = imageFrame.origin.x; |
| 77 [image_ removeFromSuperview]; | 77 [image_ removeFromSuperview]; |
| 78 image_ = nil; | 78 image_ = nil; |
| 79 [labelPlaceholder_ setFrame:labelFrame]; | 79 [labelPlaceholder_ setFrame:labelFrame]; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 LinkInfoBarController* controller = | 455 LinkInfoBarController* controller = |
| 456 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; | 456 [[LinkInfoBarController alloc] initWithDelegate:this owner:owner]; |
| 457 return new InfoBar(controller, this); | 457 return new InfoBar(controller, this); |
| 458 } | 458 } |
| 459 | 459 |
| 460 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 460 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
| 461 ConfirmInfoBarController* controller = | 461 ConfirmInfoBarController* controller = |
| 462 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; | 462 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; |
| 463 return new InfoBar(controller, this); | 463 return new InfoBar(controller, this); |
| 464 } | 464 } |
| OLD | NEW |