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