Index: chrome/browser/ui/views/location_bar/location_icon_view.cc |
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
index 03382cc2a54d3a2991f4245b0b071d5787b8ac90..dcc8829515787244513d1eab8f42ba0a18a1c8e8 100644 |
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc |
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
@@ -22,7 +22,6 @@ |
#include "ui/views/controls/label.h" |
#include "ui/views/painter.h" |
-using content::NavigationController; |
using content::NavigationEntry; |
using content::WebContents; |
@@ -34,7 +33,8 @@ LocationIconView::LocationIconView(const gfx::FontList& font_list, |
parent_background_color, |
true), |
suppress_mouse_released_action_(false), |
- location_bar_(location_bar) { |
+ location_bar_(location_bar), |
+ animation_(this) { |
set_id(VIEW_ID_LOCATION_ICON); |
#if defined(OS_MACOSX) |
@@ -166,3 +166,26 @@ void LocationIconView::SetBackground(bool should_show_ev) { |
else |
UnsetBackgroundImageGrid(); |
} |
+ |
+void LocationIconView::StartAnimation() { |
+ if (!(animation_.is_animating() || animation_.GetCurrentValue() == 1)) { |
+ animation_.SetSlideDuration(label()->GetPreferredSize().width() * 10); |
Peter Kasting
2016/08/15 23:29:50
This doesn't seem right. We should use the same t
Kevin Bailey
2016/08/16 16:39:36
Ok, was just copying other code (I think omnibox_r
Peter Kasting
2016/08/16 18:15:06
Yes, I thought about noting why I'm apparently req
|
+ animation_.Reset(0); |
Peter Kasting
2016/08/15 23:29:50
Shouldn't reset to 0 here; we should animate from
Kevin Bailey
2016/08/16 16:39:37
I'll have to work on this with the rest of the app
Kevin Bailey
2016/08/17 16:33:30
Done, and I don't think we need the checks any mor
|
+ animation_.Show(); |
+ } |
+} |
+ |
+void LocationIconView::StopAnimation() { |
+ if (animation_.is_animating() || animation_.GetCurrentValue() == 1) |
Peter Kasting
2016/08/15 23:29:50
Why is this conditional needed?
Kevin Bailey
2016/08/16 16:39:36
This replaces 'animation_already_started_'. It is
Peter Kasting
2016/08/16 18:15:06
But if it's removed, the only effect will be that
Kevin Bailey
2016/08/17 16:33:30
Done.
|
+ animation_.Reset(0); |
+} |
+ |
+void LocationIconView::AnimationProgressed(const gfx::Animation*) { |
+ // Since things are moving (sideways), we need a re-layout and paint. |
Peter Kasting
2016/08/15 23:29:50
Nit: This comment is obvious, so I'd remove it.
Kevin Bailey
2016/08/16 16:39:37
Done.
|
+ location_bar_->Layout(); |
+ location_bar_->SchedulePaint(); |
+} |
+ |
+double LocationIconView::WidthMultiplier() const { |
+ return animation_.GetCurrentValue(); |
+} |