| 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/infobars/infobar.h" | 5 #include "components/infobars/core/infobar.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "chrome/browser/infobars/infobar_container.h" | 11 #include "components/infobars/core/infobar_container.h" |
| 12 #include "chrome/browser/infobars/infobar_manager.h" | 12 #include "components/infobars/core/infobar_manager.h" |
| 13 #include "ui/gfx/animation/slide_animation.h" | 13 #include "ui/gfx/animation/slide_animation.h" |
| 14 | 14 |
| 15 namespace infobars { |
| 16 |
| 15 InfoBar::InfoBar(scoped_ptr<InfoBarDelegate> delegate) | 17 InfoBar::InfoBar(scoped_ptr<InfoBarDelegate> delegate) |
| 16 : owner_(NULL), | 18 : owner_(NULL), |
| 17 delegate_(delegate.Pass()), | 19 delegate_(delegate.Pass()), |
| 18 container_(NULL), | 20 container_(NULL), |
| 19 animation_(this), | 21 animation_(this), |
| 20 arrow_height_(0), | 22 arrow_height_(0), |
| 21 arrow_target_height_(kDefaultArrowTargetHeight), | 23 arrow_target_height_(kDefaultArrowTargetHeight), |
| 22 arrow_half_width_(0), | 24 arrow_half_width_(0), |
| 23 bar_height_(0), | 25 bar_height_(0), |
| 24 bar_target_height_(kDefaultBarTargetHeight) { | 26 bar_target_height_(kDefaultBarTargetHeight) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 container_->OnInfoBarStateChanged(animation_.is_animating()); | 168 container_->OnInfoBarStateChanged(animation_.is_animating()); |
| 167 } | 169 } |
| 168 | 170 |
| 169 void InfoBar::MaybeDelete() { | 171 void InfoBar::MaybeDelete() { |
| 170 if (!owner_ && (animation_.GetCurrentValue() == 0.0)) { | 172 if (!owner_ && (animation_.GetCurrentValue() == 0.0)) { |
| 171 if (container_) | 173 if (container_) |
| 172 container_->RemoveInfoBar(this); | 174 container_->RemoveInfoBar(this); |
| 173 delete this; | 175 delete this; |
| 174 } | 176 } |
| 175 } | 177 } |
| 178 |
| 179 } // namespace infobars |
| OLD | NEW |