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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "base/mac/mac_util.h" 6 #include "base/mac/mac_util.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 8 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
9 #include "chrome/browser/infobars/infobar.h" 9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/browser/infobars/infobar_container.h" 10 #include "chrome/browser/infobars/infobar_container.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 if (position > 0) 94 if (position > 0)
95 relativeView = [[infobarControllers_ objectAtIndex:position - 1] view]; 95 relativeView = [[infobarControllers_ objectAtIndex:position - 1] view];
96 [[self view] addSubview:[controller view] 96 [[self view] addSubview:[controller view]
97 positioned:NSWindowAbove 97 positioned:NSWindowAbove
98 relativeTo:relativeView]; 98 relativeTo:relativeView];
99 } 99 }
100 100
101 - (void)removeInfoBar:(InfoBarCocoa*)infobar { 101 - (void)removeInfoBar:(InfoBarCocoa*)infobar {
102 [infobar->controller() infobarWillClose]; 102 [infobar->controller() infobarWillClose];
103 [self removeController:infobar->controller()]; 103 [self removeController:infobar->controller()];
104 base::MessageLoop::current()->DeleteSoon(FROM_HERE, infobar);
105 } 104 }
106 105
107 - (void)positionInfoBarsAndRedraw:(BOOL)isAnimating { 106 - (void)positionInfoBarsAndRedraw:(BOOL)isAnimating {
108 if (isAnimating_ != isAnimating) { 107 if (isAnimating_ != isAnimating) {
109 isAnimating_ = isAnimating; 108 isAnimating_ = isAnimating;
110 if ([resizeDelegate_ respondsToSelector:@selector(setAnimationInProgress:)]) 109 if ([resizeDelegate_ respondsToSelector:@selector(setAnimationInProgress:)])
111 [resizeDelegate_ setAnimationInProgress:isAnimating_]; 110 [resizeDelegate_ setAnimationInProgress:isAnimating_];
112 } 111 }
113 112
114 NSRect containerBounds = [[self view] bounds]; 113 NSRect containerBounds = [[self view] bounds];
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 156
158 // This code can be executed while InfoBarController is still on the stack, so 157 // This code can be executed while InfoBarController is still on the stack, so
159 // we retain and autorelease the controller to prevent it from being 158 // we retain and autorelease the controller to prevent it from being
160 // dealloc'ed too early. 159 // dealloc'ed too early.
161 [[controller retain] autorelease]; 160 [[controller retain] autorelease];
162 [[controller view] removeFromSuperview]; 161 [[controller view] removeFromSuperview];
163 [infobarControllers_ removeObject:controller]; 162 [infobarControllers_ removeObject:controller];
164 } 163 }
165 164
166 @end 165 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698