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

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

Issue 7282036: Fix crash when clicking the close button on a closing infobar. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/tab_contents/infobar.h" 5 #include "chrome/browser/tab_contents/infobar.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void InfoBar::CloseSoon() { 94 void InfoBar::CloseSoon() {
95 owner_ = NULL; 95 owner_ = NULL;
96 MaybeDelete(); 96 MaybeDelete();
97 } 97 }
98 98
99 void InfoBar::AnimationProgressed(const ui::Animation* animation) { 99 void InfoBar::AnimationProgressed(const ui::Animation* animation) {
100 RecalculateHeights(false); 100 RecalculateHeights(false);
101 } 101 }
102 102
103 void InfoBar::RemoveInfoBar() { 103 void InfoBar::RemoveInfoBar() {
104 if (!delegate_) 104 // If the user clicks the close button when the infobar is already closing
105 // (e.g. because this is the second click of a double-click on the button),
106 // |owner_| can be NULL here, in which case we don't want to call
107 // InfoBarDismissed() either (since this can lead to us double-recording
108 // dismissals).
109 if (!delegate_ || !owner_)
105 return; 110 return;
106 delegate_->InfoBarDismissed(); 111 delegate_->InfoBarDismissed();
107 owner_->RemoveInfoBar(delegate_); 112 owner_->RemoveInfoBar(delegate_);
108 } 113 }
109 114
110 void InfoBar::SetBarTargetHeight(int height) { 115 void InfoBar::SetBarTargetHeight(int height) {
111 if (bar_target_height_ != height) { 116 if (bar_target_height_ != height) {
112 bar_target_height_ = height; 117 bar_target_height_ = height;
113 RecalculateHeights(false); 118 RecalculateHeights(false);
114 } 119 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void InfoBar::MaybeDelete() { 180 void InfoBar::MaybeDelete() {
176 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) { 181 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) {
177 if (container_) 182 if (container_)
178 container_->RemoveInfoBar(this); 183 container_->RemoveInfoBar(this);
179 delegate_->InfoBarClosed(); 184 delegate_->InfoBarClosed();
180 delegate_ = NULL; 185 delegate_ = NULL;
181 } 186 }
182 } 187 }
183 188
184 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK 189 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698