| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_util.h" | 8 #include "base/mac_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/cocoa/event_utils.h" | 10 #include "chrome/browser/cocoa/event_utils.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 - (id)initWithDelegate:(InfoBarDelegate*)delegate { | 37 - (id)initWithDelegate:(InfoBarDelegate*)delegate { |
| 38 DCHECK(delegate); | 38 DCHECK(delegate); |
| 39 if ((self = [super initWithNibName:@"InfoBar" | 39 if ((self = [super initWithNibName:@"InfoBar" |
| 40 bundle:mac_util::MainAppBundle()])) { | 40 bundle:mac_util::MainAppBundle()])) { |
| 41 delegate_ = delegate; | 41 delegate_ = delegate; |
| 42 } | 42 } |
| 43 return self; | 43 return self; |
| 44 } | 44 } |
| 45 | 45 |
| 46 - (void)dealloc { |
| 47 // Remove our view from its superview so it doesn't attempt to reference |
| 48 // it when the controller is gone. |
| 49 [[self view] removeFromSuperview]; |
| 50 [super dealloc]; |
| 51 } |
| 52 |
| 46 // All infobars have an icon, so we set up the icon in the base class | 53 // All infobars have an icon, so we set up the icon in the base class |
| 47 // awakeFromNib. | 54 // awakeFromNib. |
| 48 - (void)awakeFromNib { | 55 - (void)awakeFromNib { |
| 49 if (delegate_->GetIcon()) { | 56 if (delegate_->GetIcon()) { |
| 50 [image_ setImage:gfx::SkBitmapToNSImage(*(delegate_->GetIcon()))]; | 57 [image_ setImage:gfx::SkBitmapToNSImage(*(delegate_->GetIcon()))]; |
| 51 } else { | 58 } else { |
| 52 // No icon, remove it from the view and grow the textfield to include the | 59 // No icon, remove it from the view and grow the textfield to include the |
| 53 // space. | 60 // space. |
| 54 NSRect imageFrame = [image_ frame]; | 61 NSRect imageFrame = [image_ frame]; |
| 55 NSRect labelFrame = [label_ frame]; | 62 NSRect labelFrame = [label_ frame]; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 LinkInfoBarController* controller = | 324 LinkInfoBarController* controller = |
| 318 [[LinkInfoBarController alloc] initWithDelegate:this]; | 325 [[LinkInfoBarController alloc] initWithDelegate:this]; |
| 319 return new InfoBar(controller); | 326 return new InfoBar(controller); |
| 320 } | 327 } |
| 321 | 328 |
| 322 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { | 329 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { |
| 323 ConfirmInfoBarController* controller = | 330 ConfirmInfoBarController* controller = |
| 324 [[ConfirmInfoBarController alloc] initWithDelegate:this]; | 331 [[ConfirmInfoBarController alloc] initWithDelegate:this]; |
| 325 return new InfoBar(controller); | 332 return new InfoBar(controller); |
| 326 } | 333 } |
| OLD | NEW |