| 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 #if defined(TOOLKIT_VIEWS) // TODO(pkasting): Port non-views to use this. | 5 #if defined(TOOLKIT_VIEWS) // TODO(pkasting): Port non-views to use this. |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/infobar_container.h" | 7 #include "chrome/browser/tab_contents/infobar_container.h" |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/infobar.h" | 9 #include "chrome/browser/tab_contents/infobar.h" |
| 10 #include "chrome/browser/tab_contents/infobar_delegate.h" | 10 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 std::max(height - InfoBar::kSeparatorLineHeight, 0), | 89 std::max(height - InfoBar::kSeparatorLineHeight, 0), |
| 90 InfoBar::kMaximumArrowTargetHeight); | 90 InfoBar::kMaximumArrowTargetHeight); |
| 91 UpdateInfoBarArrowTargetHeights(); | 91 UpdateInfoBarArrowTargetHeights(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void InfoBarContainer::OnInfoBarStateChanged(bool is_animating) { | 94 void InfoBarContainer::OnInfoBarStateChanged(bool is_animating) { |
| 95 if (delegate_) | 95 if (delegate_) |
| 96 delegate_->InfoBarContainerStateChanged(is_animating); | 96 delegate_->InfoBarContainerStateChanged(is_animating); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { | |
| 100 tab_contents_->RemoveInfoBar(delegate); | |
| 101 } | |
| 102 | |
| 103 void InfoBarContainer::RemoveInfoBar(InfoBar* infobar) { | 99 void InfoBarContainer::RemoveInfoBar(InfoBar* infobar) { |
| 104 InfoBars::iterator infobar_iterator(std::find(infobars_.begin(), | 100 InfoBars::iterator infobar_iterator(std::find(infobars_.begin(), |
| 105 infobars_.end(), infobar)); | 101 infobars_.end(), infobar)); |
| 106 DCHECK(infobar_iterator != infobars_.end()); | 102 DCHECK(infobar_iterator != infobars_.end()); |
| 107 PlatformSpecificRemoveInfoBar(infobar); | 103 PlatformSpecificRemoveInfoBar(infobar); |
| 108 infobars_.erase(infobar_iterator); | 104 infobars_.erase(infobar_iterator); |
| 109 } | 105 } |
| 110 | 106 |
| 111 void InfoBarContainer::RemoveAllInfoBarsForDestruction() { | 107 void InfoBarContainer::RemoveAllInfoBarsForDestruction() { |
| 112 // Before we remove any children, we reset |delegate_|, so that no removals | 108 // Before we remove any children, we reset |delegate_|, so that no removals |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 return InfoBar::kDefaultArrowTargetHeight; | 199 return InfoBar::kDefaultArrowTargetHeight; |
| 204 // When the first infobar is animating closed, we animate the second infobar's | 200 // When the first infobar is animating closed, we animate the second infobar's |
| 205 // arrow target height from the default to the top target height. Note that | 201 // arrow target height from the default to the top target height. Note that |
| 206 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. | 202 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. |
| 207 return top_arrow_target_height_ + static_cast<int>( | 203 return top_arrow_target_height_ + static_cast<int>( |
| 208 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * | 204 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * |
| 209 first_infobar_animation->GetCurrentValue()); | 205 first_infobar_animation->GetCurrentValue()); |
| 210 } | 206 } |
| 211 | 207 |
| 212 #endif // TOOLKIT_VIEWS | 208 #endif // TOOLKIT_VIEWS |
| OLD | NEW |