Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6342)

Unified Diff: chrome/browser/ui/views/toolbar/app_menu_animation.cc

Issue 2843413003: [Views] App Menu Icon Update (Closed)
Patch Set: Fixes for msw Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/toolbar/app_menu_animation.cc
diff --git a/chrome/browser/ui/views/toolbar/app_menu_animation.cc b/chrome/browser/ui/views/toolbar/app_menu_animation.cc
index 8d643cade30dc8403f65a7f03e2f1a90f00d1fd5..01d0b5a07074a3ec2faae7516f823f07e24065f8 100644
--- a/chrome/browser/ui/views/toolbar/app_menu_animation.cc
+++ b/chrome/browser/ui/views/toolbar/app_menu_animation.cc
@@ -60,7 +60,7 @@ AppMenuAnimation::AppMenuDot::AppMenuDot(base::TimeDelta delay,
void AppMenuAnimation::AppMenuDot::Paint(const gfx::PointF& center_point,
SkColor start_color,
- SkColor severity_color,
+ SkColor target_color,
gfx::Canvas* canvas,
const gfx::Rect& bounds,
const gfx::SlideAnimation* animation) {
@@ -110,8 +110,8 @@ void AppMenuAnimation::AppMenuDot::Paint(const gfx::PointF& center_point,
point.Offset(-dot_width / 2, -dot_height / 2);
SkColor color = is_opening ? gfx::Tween::ColorValueBetween(
- color_progress, start_color, severity_color)
- : severity_color;
+ color_progress, start_color, target_color)
+ : target_color;
cc::PaintFlags flags;
flags.setColor(color);
@@ -124,10 +124,8 @@ void AppMenuAnimation::AppMenuDot::Paint(const gfx::PointF& center_point,
canvas->DrawRoundRect(gfx::RectF(point, dot_size), 2.0, flags);
}
-AppMenuAnimation::AppMenuAnimation(AppMenuButton* owner,
- bool should_animate_closed)
+AppMenuAnimation::AppMenuAnimation(AppMenuButton* owner, SkColor initial_color)
: owner_(owner),
- should_animate_closed_(should_animate_closed),
animation_(base::MakeUnique<gfx::SlideAnimation>(this)),
bottom_dot_(base::TimeDelta(),
kBottomWidthOpenInterval,
@@ -138,8 +136,8 @@ AppMenuAnimation::AppMenuAnimation(AppMenuButton* owner,
top_dot_(base::TimeDelta::FromMilliseconds(kDotDelayMs * 2),
kTopWidthOpenInterval,
kTopStrokeOpenInterval),
- start_color_(gfx::kPlaceholderColor),
- severity_color_(gfx::kPlaceholderColor) {
+ start_color_(initial_color),
+ target_color_(initial_color) {
animation_->SetSlideDuration(kOpenDurationMs);
animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN);
}
@@ -156,20 +154,14 @@ void AppMenuAnimation::PaintAppMenu(gfx::Canvas* canvas,
gfx::PointF bottom_point = middle_point;
bottom_point.Offset(0, y_offset);
- middle_dot_.Paint(middle_point, start_color_, severity_color_, canvas, bounds,
+ middle_dot_.Paint(middle_point, start_color_, target_color_, canvas, bounds,
animation_.get());
- top_dot_.Paint(top_point, start_color_, severity_color_, canvas, bounds,
+ top_dot_.Paint(top_point, start_color_, target_color_, canvas, bounds,
animation_.get());
- bottom_dot_.Paint(bottom_point, start_color_, severity_color_, canvas, bounds,
+ bottom_dot_.Paint(bottom_point, start_color_, target_color_, canvas, bounds,
animation_.get());
}
-void AppMenuAnimation::SetIconColors(SkColor start_color,
- SkColor severity_color) {
- start_color_ = start_color;
- severity_color_ = severity_color;
-}
-
void AppMenuAnimation::StartAnimation() {
if (!animation_->is_animating()) {
animation_->SetSlideDuration(kOpenDurationMs);
@@ -179,15 +171,13 @@ void AppMenuAnimation::StartAnimation() {
}
void AppMenuAnimation::AnimationEnded(const gfx::Animation* animation) {
- if (animation_->IsShowing() && should_animate_closed_) {
+ if (animation_->IsShowing()) {
animation_->SetSlideDuration(kCloseDurationMs);
animation_->Hide();
- return;
+ } else {
+ start_color_ = target_color_;
}
- if (!animation_->IsShowing())
- start_color_ = severity_color_;
-
owner_->AppMenuAnimationEnded();
}
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu_animation.h ('k') | chrome/browser/ui/views/toolbar/app_menu_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698