| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/infobar_arrow_model.h" | 5 #include "chrome/browser/gtk/infobar_arrow_model.h" |
| 6 | 6 |
| 7 #include "chrome/browser/gtk/infobar_gtk.h" | 7 #include "chrome/browser/gtk/infobar_gtk.h" |
| 8 #include "gfx/canvas_skia_paint.h" | 8 #include "gfx/canvas_skia_paint.h" |
| 9 #include "gfx/color_utils.h" | 9 #include "gfx/color_utils.h" |
| 10 #include "gfx/point.h" | 10 #include "gfx/point.h" |
| 11 #include "gfx/skia_utils_gtk.h" | 11 #include "gfx/skia_utils_gtk.h" |
| 12 #include "third_party/skia/include/effects/SkGradientShader.h" | 12 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 13 | 13 |
| 14 InfoBarArrowModel::InfoBarArrowModel(Observer* observer) | 14 InfoBarArrowModel::InfoBarArrowModel(Observer* observer) |
| 15 : observer_(observer), | 15 : observer_(observer), |
| 16 animation_(this) { | 16 animation_(this) { |
| 17 animation_.SetTweenType(Tween::LINEAR); | 17 animation_.SetTweenType(ui::Tween::LINEAR); |
| 18 animation_.Reset(1.0); | 18 animation_.Reset(1.0); |
| 19 target_colors_.top = target_colors_.bottom = SkColorSetARGB(0, 0, 0, 0); | 19 target_colors_.top = target_colors_.bottom = SkColorSetARGB(0, 0, 0, 0); |
| 20 previous_colors_ = target_colors_; | 20 previous_colors_ = target_colors_; |
| 21 } | 21 } |
| 22 | 22 |
| 23 InfoBarArrowModel::~InfoBarArrowModel() { | 23 InfoBarArrowModel::~InfoBarArrowModel() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 InfoBarArrowModel::InfoBarColors InfoBarArrowModel::CurrentInfoBarColors() { | 26 InfoBarArrowModel::InfoBarColors InfoBarArrowModel::CurrentInfoBarColors() { |
| 27 double alpha = animation_.GetCurrentValue(); | 27 double alpha = animation_.GetCurrentValue(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 gfx::CanvasSkiaPaint canvas(expose, false); | 104 gfx::CanvasSkiaPaint canvas(expose, false); |
| 105 canvas.drawPath(path, paint); | 105 canvas.drawPath(path, paint); |
| 106 | 106 |
| 107 paint.setShader(NULL); | 107 paint.setShader(NULL); |
| 108 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(border_color), | 108 paint.setColor(SkColorSetA(gfx::GdkColorToSkColor(border_color), |
| 109 SkColorGetA(colors.top))); | 109 SkColorGetA(colors.top))); |
| 110 paint.setStyle(SkPaint::kStroke_Style); | 110 paint.setStyle(SkPaint::kStroke_Style); |
| 111 canvas.drawPath(path, paint); | 111 canvas.drawPath(path, paint); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void InfoBarArrowModel::AnimationEnded(const Animation* animation) { | 114 void InfoBarArrowModel::AnimationEnded(const ui::Animation* animation) { |
| 115 observer_->PaintStateChanged(); | 115 observer_->PaintStateChanged(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void InfoBarArrowModel::AnimationProgressed(const Animation* animation) { | 118 void InfoBarArrowModel::AnimationProgressed(const ui::Animation* animation) { |
| 119 observer_->PaintStateChanged(); | 119 observer_->PaintStateChanged(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void InfoBarArrowModel::AnimationCanceled(const Animation* animation) { | 122 void InfoBarArrowModel::AnimationCanceled(const ui::Animation* animation) { |
| 123 observer_->PaintStateChanged(); | 123 observer_->PaintStateChanged(); |
| 124 } | 124 } |
| OLD | NEW |