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