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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 replaceSubview:labelPlaceholder_ with:label_.get()]; | 241 replaceSubview:labelPlaceholder_ with:label_.get()]; |
242 labelPlaceholder_ = nil; // Now released. | 242 labelPlaceholder_ = nil; // Now released. |
243 [label_.get() setDelegate:self]; | 243 [label_.get() setDelegate:self]; |
244 } | 244 } |
245 | 245 |
246 - (void)cleanUpAfterAnimation:(BOOL)finished { | 246 - (void)cleanUpAfterAnimation:(BOOL)finished { |
247 // Don't need to do any cleanup if the bar was animating open. | 247 // Don't need to do any cleanup if the bar was animating open. |
248 if (!infoBarClosing_) | 248 if (!infoBarClosing_) |
249 return; | 249 return; |
250 | 250 |
251 // Notify the delegate that the infobar was closed. The delegate will delete | |
252 // itself as a result of InfoBarClosed(), so we null out its pointer. | |
253 if (delegate_) { | 251 if (delegate_) { |
254 delegate_->InfoBarClosed(); | 252 delete delegate_; |
255 delegate_ = NULL; | 253 delegate_ = NULL; |
256 } | 254 } |
257 | 255 |
258 // If the animation ran to completion, then we need to remove ourselves from | 256 // If the animation ran to completion, then we need to remove ourselves from |
259 // the container. If the animation was interrupted, then the container will | 257 // the container. If the animation was interrupted, then the container will |
260 // take care of removing us. | 258 // take care of removing us. |
261 // TODO(rohitrao): UGH! This works for now, but should be cleaner. | 259 // TODO(rohitrao): UGH! This works for now, but should be cleaner. |
262 if (finished) | 260 if (finished) |
263 [containerController_ removeController:self]; | 261 [containerController_ removeController:self]; |
264 } | 262 } |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 AlternateNavInfoBarController* controller = | 465 AlternateNavInfoBarController* controller = |
468 [[AlternateNavInfoBarController alloc] initWithDelegate:this owner:owner]; | 466 [[AlternateNavInfoBarController alloc] initWithDelegate:this owner:owner]; |
469 return new InfoBar(controller, this); | 467 return new InfoBar(controller, this); |
470 } | 468 } |
471 | 469 |
472 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { | 470 InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) { |
473 ConfirmInfoBarController* controller = | 471 ConfirmInfoBarController* controller = |
474 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; | 472 [[ConfirmInfoBarController alloc] initWithDelegate:this owner:owner]; |
475 return new InfoBar(controller, this); | 473 return new InfoBar(controller, this); |
476 } | 474 } |
OLD | NEW |