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..fa81aef8825836fc52bbed7dcee9b085787c0091 100644 |
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc |
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc |
@@ -4,6 +4,8 @@ |
#include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
+#include <iostream> |
+ |
#include "base/strings/utf_string_conversions.h" |
#include "chrome/browser/ssl/chrome_security_state_model_client.h" |
#include "chrome/browser/ui/view_ids.h" |
@@ -34,7 +36,9 @@ 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), |
+ animation_already_started_(false) { |
set_id(VIEW_ID_LOCATION_ICON); |
#if defined(OS_MACOSX) |
@@ -44,12 +48,15 @@ LocationIconView::LocationIconView(const gfx::FontList& font_list, |
#endif |
SetBackground(false); |
+ std::cout << "constructed " << (void*)this << "\n"; |
} |
LocationIconView::~LocationIconView() { |
+ std::cout << "destructed " << (void*)this << "\n"; |
} |
bool LocationIconView::OnMousePressed(const ui::MouseEvent& event) { |
+ std::cout << "pressed " << (void*)this << "\n"; |
if (event.IsOnlyMiddleMouseButton() && |
ui::Clipboard::IsSupportedClipboardType(ui::CLIPBOARD_TYPE_SELECTION)) { |
base::string16 text; |
@@ -166,3 +173,35 @@ void LocationIconView::SetBackground(bool should_show_ev) { |
else |
UnsetBackgroundImageGrid(); |
} |
+ |
+void LocationIconView::StartAnimation() { |
+ if (!animation_already_started_) { |
+ std::cout << "width is " << label()->GetPreferredSize().width() << "\n"; |
+ animation_.SetSlideDuration(label()->GetPreferredSize().width() * 10); |
+ // They don't tell you but, to get it slide "down", you must do both: |
Peter Kasting
2016/07/19 21:17:21
Who doesn't tell you? If you're trying to animate
Kevin Bailey
2016/08/12 18:49:15
slide_animation.h says:
// Begin a hiding anima
|
+ animation_.Reset(1); |
+ animation_.Hide(); |
+ animation_already_started_ = true; |
+ } |
+} |
+ |
+void LocationIconView::AnimationProgressed(const gfx::Animation*) { |
+ std::cout << "progressed " << animation_.GetCurrentValue() << "\n"; |
+ // Since things are moving (sideways), we need a re-layout and paint. |
+ location_bar_->Layout(); |
+ location_bar_->SchedulePaint(); |
+} |
+ |
+/* |
+int LocationIconView::GetLabelPreferredWidth() const { |
+ gfx::Rect size(label()->GetPreferredSize()); |
+ return size.width() * animation_.GetCurrentValue(); |
+} |
+*/ |
+double LocationIconView::WidthMultiplier() const { |
+ return animation_.GetCurrentValue(); |
+} |
+ |
+bool LocationIconView::IsShrinking() const { |
+ return true; |
+} |