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

Side by Side Diff: chrome/browser/tab_contents/infobar_container.cc

Issue 7294006: Try to bandaid leaks due to TabContentsWrapper not force-closing all InfoBarDelegates on shutdown... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 // TODO(pkasting): Port Mac to use this. 7 // TODO(pkasting): Port Mac to use this.
8 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) 8 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK)
9 9
10 #include "chrome/browser/tab_contents/infobar_container.h" 10 #include "chrome/browser/tab_contents/infobar_container.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 infobars_.erase(i); 105 infobars_.erase(i);
106 } 106 }
107 107
108 void InfoBarContainer::RemoveAllInfoBarsForDestruction() { 108 void InfoBarContainer::RemoveAllInfoBarsForDestruction() {
109 // Before we remove any children, we reset |delegate_|, so that no removals 109 // Before we remove any children, we reset |delegate_|, so that no removals
110 // will result in us trying to call 110 // will result in us trying to call
111 // delegate_->InfoBarContainerStateChanged(). This is important because at 111 // delegate_->InfoBarContainerStateChanged(). This is important because at
112 // this point |delegate_| may be shutting down, and it's at best unimportant 112 // this point |delegate_| may be shutting down, and it's at best unimportant
113 // and at worst disastrous to call that. 113 // and at worst disastrous to call that.
114 delegate_ = NULL; 114 delegate_ = NULL;
115
116 // TODO(pkasting): Remove this once TabContentsWrapper calls CloseSoon().
117 for (size_t i = infobars_.size(); i > 0; --i)
118 infobars_[i]->CloseSoon();
119
115 ChangeTabContents(NULL); 120 ChangeTabContents(NULL);
116 } 121 }
117 122
118 void InfoBarContainer::Observe(NotificationType type, 123 void InfoBarContainer::Observe(NotificationType type,
119 const NotificationSource& source, 124 const NotificationSource& source,
120 const NotificationDetails& details) { 125 const NotificationDetails& details) {
121 switch (type.value) { 126 switch (type.value) {
122 case NotificationType::TAB_CONTENTS_INFOBAR_ADDED: 127 case NotificationType::TAB_CONTENTS_INFOBAR_ADDED:
123 AddInfoBar( 128 AddInfoBar(
124 Details<InfoBarDelegate>(details)->CreateInfoBar(tab_contents_), 129 Details<InfoBarDelegate>(details)->CreateInfoBar(tab_contents_),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return InfoBar::kDefaultArrowTargetHeight; 206 return InfoBar::kDefaultArrowTargetHeight;
202 // When the first infobar is animating closed, we animate the second infobar's 207 // When the first infobar is animating closed, we animate the second infobar's
203 // arrow target height from the default to the top target height. Note that 208 // arrow target height from the default to the top target height. Note that
204 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. 209 // the animation values here are going from 1.0 -> 0.0 as the top bar closes.
205 return top_arrow_target_height_ + static_cast<int>( 210 return top_arrow_target_height_ + static_cast<int>(
206 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * 211 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) *
207 first_infobar_animation.GetCurrentValue()); 212 first_infobar_animation.GetCurrentValue());
208 } 213 }
209 214
210 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) 215 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698