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

Unified Diff: chrome/browser/ui/panels/panel_browser_view.cc

Issue 8775022: Add Panel::SetPanelBoundsInstantly for all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/panels/panel_browser_view.cc
diff --git a/chrome/browser/ui/panels/panel_browser_view.cc b/chrome/browser/ui/panels/panel_browser_view.cc
index 0a887e2e5106c468c3f6da82f4a9c8dd84b48ee0..0e4b5e730bf6a31337d97e65d4642906040d3e78 100644
--- a/chrome/browser/ui/panels/panel_browser_view.cc
+++ b/chrome/browser/ui/panels/panel_browser_view.cc
@@ -108,26 +108,7 @@ bool PanelBrowserView::CanMaximize() const {
}
void PanelBrowserView::SetBounds(const gfx::Rect& bounds) {
- if (bounds_ == bounds)
- return;
- bounds_ = bounds;
-
- // No animation if the panel is being dragged.
- if (mouse_dragging_state_ == DRAGGING_STARTED) {
- ::BrowserView::SetBounds(bounds);
- return;
- }
-
- animation_start_bounds_ = GetBounds();
-
- if (!bounds_animator_.get()) {
- bounds_animator_.reset(new ui::SlideAnimation(this));
- bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs);
- }
-
- if (bounds_animator_->IsShowing())
- bounds_animator_->Reset();
- bounds_animator_->Show();
+ SetPanelBounds(bounds, true); // use animation.
}
void PanelBrowserView::UpdateTitleBar() {
@@ -232,8 +213,27 @@ gfx::Rect PanelBrowserView::GetPanelBounds() const {
return bounds_;
}
-void PanelBrowserView::SetPanelBounds(const gfx::Rect& bounds) {
- SetBounds(bounds);
+void PanelBrowserView::SetPanelBounds(const gfx::Rect& bounds, bool animate) {
+ if (bounds_ == bounds)
+ return;
+ bounds_ = bounds;
+
+ // No animation if the panel is being dragged.
+ if (!animate || mouse_dragging_state_ == DRAGGING_STARTED) {
+ ::BrowserView::SetBounds(bounds);
+ return;
+ }
+
+ animation_start_bounds_ = GetBounds();
+
+ if (!bounds_animator_.get()) {
+ bounds_animator_.reset(new ui::SlideAnimation(this));
+ bounds_animator_->SetSlideDuration(kSetBoundsAnimationMs);
+ }
+
+ if (bounds_animator_->IsShowing())
+ bounds_animator_->Reset();
+ bounds_animator_->Show();
}
void PanelBrowserView::ClosePanel() {

Powered by Google App Engine
This is Rietveld 408576698