Index: chrome/browser/ui/panels/panel_browser_window_gtk.cc |
diff --git a/chrome/browser/ui/panels/panel_browser_window_gtk.cc b/chrome/browser/ui/panels/panel_browser_window_gtk.cc |
index d628e3478ed3d2f3d3b40e9d611410af30ec06a4..ded4e1b302b6a21b95de3f0569813eb001932453 100644 |
--- a/chrome/browser/ui/panels/panel_browser_window_gtk.cc |
+++ b/chrome/browser/ui/panels/panel_browser_window_gtk.cc |
@@ -9,6 +9,7 @@ |
#include "chrome/browser/ui/panels/panel.h" |
#include "chrome/browser/ui/panels/panel_manager.h" |
#include "chrome/browser/ui/panels/panel_settings_menu_model.h" |
+#include "chrome/browser/ui/panels/panel_slide_animation.h" |
#include "chrome/common/chrome_notification_types.h" |
#include "content/public/browser/notification_service.h" |
#include "ui/base/animation/slide_animation.h" |
@@ -17,9 +18,6 @@ |
namespace { |
-// This value is experimental and subjective. |
-const int kSetBoundsAnimationMs = 180; |
- |
// RGB values for titlebar in draw attention state. A shade of orange. |
const int kDrawAttentionR = 0xfa; |
const int kDrawAttentionG = 0x98; |
@@ -149,7 +147,7 @@ void PanelBrowserWindowGtk::OnSizeChanged(int width, int height) { |
int left = bounds_.right() - width; |
gtk_window_move(window_, left, top); |
- StartBoundsAnimation(gfx::Rect(left, top, width, height)); |
+ StartBoundsAnimation(bounds_, gfx::Rect(left, top, width, height)); |
panel_->OnWindowSizeAvailable(); |
content::NotificationService::current()->Notify( |
@@ -262,7 +260,7 @@ void PanelBrowserWindowGtk::SetBoundsInternal(const gfx::Rect& bounds, |
// user drag, we should not animate. |
gtk_window_move(window(), bounds.x(), bounds.y()); |
} else if (window_size_known_) { |
- StartBoundsAnimation(bounds_); |
+ StartBoundsAnimation(bounds_, bounds); |
} |
// If window size is not known, wait till the size is known before starting |
// the animation. |
@@ -412,16 +410,11 @@ int PanelBrowserWindowGtk::TitleOnlyHeight() const { |
} |
void PanelBrowserWindowGtk::StartBoundsAnimation( |
- const gfx::Rect& current_bounds) { |
- animation_start_bounds_ = current_bounds; |
- |
- if (!bounds_animator_.get()) { |
- bounds_animator_.reset(new ui::SlideAnimation(this)); |
- bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs); |
- } |
+ const gfx::Rect& from_bounds, const gfx::Rect& to_bounds) { |
+ animation_start_bounds_ = from_bounds; |
- if (bounds_animator_->IsShowing()) |
- bounds_animator_->Reset(); |
+ bounds_animator_.reset(new PanelSlideAnimation( |
+ this, panel_.get(), from_bounds, to_bounds)); |
bounds_animator_->Show(); |
} |