| 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 "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/infobars/infobar_container.h" | 10 #include "chrome/browser/infobars/infobar_container.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 void InfoBarContainer::RemoveAllInfoBarsForDestruction() { | 111 void InfoBarContainer::RemoveAllInfoBarsForDestruction() { |
| 112 // Before we remove any children, we reset |delegate_|, so that no removals | 112 // Before we remove any children, we reset |delegate_|, so that no removals |
| 113 // will result in us trying to call | 113 // will result in us trying to call |
| 114 // delegate_->InfoBarContainerStateChanged(). This is important because at | 114 // delegate_->InfoBarContainerStateChanged(). This is important because at |
| 115 // this point |delegate_| may be shutting down, and it's at best unimportant | 115 // this point |delegate_| may be shutting down, and it's at best unimportant |
| 116 // and at worst disastrous to call that. | 116 // and at worst disastrous to call that. |
| 117 delegate_ = NULL; | 117 delegate_ = NULL; |
| 118 | 118 |
| 119 // TODO(pkasting): Remove this once TabContentsWrapper calls CloseSoon(). | 119 // TODO(pkasting): Remove this once TabContents calls CloseSoon(). |
| 120 for (size_t i = infobars_.size(); i > 0; --i) | 120 for (size_t i = infobars_.size(); i > 0; --i) |
| 121 infobars_[i - 1]->CloseSoon(); | 121 infobars_[i - 1]->CloseSoon(); |
| 122 | 122 |
| 123 ChangeTabContents(NULL); | 123 ChangeTabContents(NULL); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void InfoBarContainer::Observe(int type, | 126 void InfoBarContainer::Observe(int type, |
| 127 const content::NotificationSource& source, | 127 const content::NotificationSource& source, |
| 128 const content::NotificationDetails& details) { | 128 const content::NotificationDetails& details) { |
| 129 switch (type) { | 129 switch (type) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 return InfoBar::kDefaultArrowTargetHeight; | 210 return InfoBar::kDefaultArrowTargetHeight; |
| 211 // When the first infobar is animating closed, we animate the second infobar's | 211 // When the first infobar is animating closed, we animate the second infobar's |
| 212 // arrow target height from the default to the top target height. Note that | 212 // arrow target height from the default to the top target height. Note that |
| 213 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. | 213 // the animation values here are going from 1.0 -> 0.0 as the top bar closes. |
| 214 return top_arrow_target_height_ + static_cast<int>( | 214 return top_arrow_target_height_ + static_cast<int>( |
| 215 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * | 215 (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * |
| 216 first_infobar_animation.GetCurrentValue()); | 216 first_infobar_animation.GetCurrentValue()); |
| 217 } | 217 } |
| 218 | 218 |
| 219 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) | 219 #endif // TOOLKIT_VIEWS || defined(TOOLKIT_GTK) |
| OLD | NEW |