Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/ui/cocoa/infobars/infobar_controller.mm

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/infobars/infobar_container_controller.h ('k') | chrome/browser/ui/cocoa/keystone_infobar_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698