Chromium Code Reviews| Index: chrome/browser/tab_contents/infobar.cc |
| =================================================================== |
| --- chrome/browser/tab_contents/infobar.cc (revision 84494) |
| +++ chrome/browser/tab_contents/infobar.cc (working copy) |
| @@ -2,16 +2,19 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome/browser/ui/views/infobars/infobar.h" |
| +#if defined(TOOLKIT_VIEWS) // TODO(pkasting): Port non-views to use this. |
| +#include "chrome/browser/tab_contents/infobar.h" |
| + |
| #include <cmath> |
| +#include "chrome/browser/tab_contents/infobar_container.h" |
| +#include "chrome/browser/tab_contents/infobar_delegate.h" |
| #include "ui/base/animation/slide_animation.h" |
| -#include "chrome/browser/tab_contents/infobar_delegate.h" |
| -#include "chrome/browser/ui/views/infobars/infobar_container.h" |
| -InfoBar::InfoBar(InfoBarDelegate* delegate) |
| - : delegate_(delegate), |
| +InfoBar::InfoBar(TabContents* owner, InfoBarDelegate* delegate) |
| + : owner_(owner), |
| + delegate_(delegate), |
| container_(NULL), |
| ALLOW_THIS_IN_INITIALIZER_LIST(animation_(new ui::SlideAnimation(this))), |
| arrow_height_(0), |
| @@ -19,6 +22,7 @@ |
| arrow_half_width_(0), |
| bar_height_(0), |
| bar_target_height_(kDefaultBarTargetHeight) { |
| + DCHECK(owner != NULL); |
| DCHECK(delegate != NULL); |
| animation_->SetTweenType(ui::Tween::LINEAR); |
| } |
| @@ -95,7 +99,7 @@ |
| // scaling each of these with the square root of the animation value causes a |
| // linear animation of the area, which matches the perception of the animation |
| // of the bar portion. |
| - double scale_factor = sqrt(animation()->GetCurrentValue()); |
| + double scale_factor = sqrt(animation_->GetCurrentValue()); |
| arrow_height_ = static_cast<int>(arrow_target_height_ * scale_factor); |
| if (animation_->is_animating()) { |
| arrow_half_width_ = static_cast<int>(std::min(arrow_target_height_, |
| @@ -117,7 +121,7 @@ |
| arrow_height_ += kSeparatorLineHeight; |
| bar_height_ = |
| - static_cast<int>(bar_target_height_ * animation()->GetCurrentValue()); |
| + static_cast<int>(bar_target_height_ * animation_->GetCurrentValue()); |
|
sky
2011/05/09 22:56:39
This should use Tween::ValueBetween
Peter Kasting
2011/05/09 23:23:33
Or even better, Animation::CurrentValueBetween().
|
| // Don't re-layout if nothing has changed, e.g. because the animation step was |
| // not large enough to actually change the heights by at least a pixel. |
| @@ -141,3 +145,5 @@ |
| delegate_ = NULL; |
| } |
| } |
| + |
| +#endif // TOOLKIT_VIEWS |