OLD | NEW |
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 owner_ = NULL; | 96 owner_ = NULL; |
97 PlatformSpecificOnCloseSoon(); | 97 PlatformSpecificOnCloseSoon(); |
98 MaybeDelete(); | 98 MaybeDelete(); |
99 } | 99 } |
100 | 100 |
101 void InfoBar::AnimationProgressed(const ui::Animation* animation) { | 101 void InfoBar::AnimationProgressed(const ui::Animation* animation) { |
102 RecalculateHeights(false); | 102 RecalculateHeights(false); |
103 } | 103 } |
104 | 104 |
105 void InfoBar::RemoveSelf() { | 105 void InfoBar::RemoveSelf() { |
106 // |owner_| can be NULL here, e.g. because the user clicks the close button | 106 DCHECK(owner_); |
107 // when the infobar is already closing. | 107 owner_->infobar_tab_helper()->RemoveInfoBar(delegate_); |
108 if (delegate_ && owner_) | |
109 owner_->infobar_tab_helper()->RemoveInfoBar(delegate_); | |
110 } | 108 } |
111 | 109 |
112 void InfoBar::SetBarTargetHeight(int height) { | 110 void InfoBar::SetBarTargetHeight(int height) { |
113 if (bar_target_height_ != height) { | 111 if (bar_target_height_ != height) { |
114 bar_target_height_ = height; | 112 bar_target_height_ = height; |
115 RecalculateHeights(false); | 113 RecalculateHeights(false); |
116 } | 114 } |
117 } | 115 } |
118 | 116 |
119 int InfoBar::OffsetY(const gfx::Size& prefsize) const { | 117 int InfoBar::OffsetY(const gfx::Size& prefsize) const { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void InfoBar::MaybeDelete() { | 175 void InfoBar::MaybeDelete() { |
178 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) { | 176 if (!owner_ && delegate_ && (animation_.GetCurrentValue() == 0.0)) { |
179 if (container_) | 177 if (container_) |
180 container_->RemoveInfoBar(this); | 178 container_->RemoveInfoBar(this); |
181 delegate_->InfoBarClosed(); | 179 delegate_->InfoBarClosed(); |
182 delegate_ = NULL; | 180 delegate_ = NULL; |
183 } | 181 } |
184 } | 182 } |
185 | 183 |
186 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK | 184 #endif // TOOLKIT_VIEWS || TOOLKIT_GTK |
OLD | NEW |