| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 void PanelBrowserWindowGtk::ShowPanelInactive() { | 239 void PanelBrowserWindowGtk::ShowPanelInactive() { |
| 240 ShowInactive(); | 240 ShowInactive(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 gfx::Rect PanelBrowserWindowGtk::GetPanelBounds() const { | 243 gfx::Rect PanelBrowserWindowGtk::GetPanelBounds() const { |
| 244 return bounds_; | 244 return bounds_; |
| 245 } | 245 } |
| 246 | 246 |
| 247 void PanelBrowserWindowGtk::SetPanelBounds(const gfx::Rect& bounds) { | 247 void PanelBrowserWindowGtk::SetPanelBounds(const gfx::Rect& bounds) { |
| 248 SetBoundsInternal(bounds, true); |
| 249 } |
| 250 |
| 251 void PanelBrowserWindowGtk::SetPanelBoundsInstantly(const gfx::Rect& bounds) { |
| 252 SetBoundsInternal(bounds, false); |
| 253 } |
| 254 |
| 255 void PanelBrowserWindowGtk::SetBoundsInternal(const gfx::Rect& bounds, |
| 256 bool animate) { |
| 248 if (bounds == bounds_) | 257 if (bounds == bounds_) |
| 249 return; | 258 return; |
| 250 | 259 |
| 251 if (drag_widget_) { | 260 if (drag_widget_ || !animate) { |
| 252 DCHECK(!bounds_animator_.get() || !bounds_animator_->is_animating()); | 261 DCHECK(!bounds_animator_.get() || !bounds_animator_->is_animating()); |
| 253 // If the current panel is being dragged, it should just move with the | 262 // If the current panel is being dragged, it should just move with the |
| 254 // user drag, we should not animate. | 263 // user drag, we should not animate. |
| 255 gtk_window_move(window(), bounds.x(), bounds.y()); | 264 gtk_window_move(window(), bounds.x(), bounds.y()); |
| 256 } else if (window_size_known_) { | 265 } else if (window_size_known_) { |
| 257 StartBoundsAnimation(bounds_); | 266 StartBoundsAnimation(bounds_); |
| 258 } | 267 } |
| 259 // If window size is not known, wait till the size is known before starting | 268 // If window size is not known, wait till the size is known before starting |
| 260 // the animation. | 269 // the animation. |
| 261 | 270 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 } | 753 } |
| 745 } | 754 } |
| 746 | 755 |
| 747 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 756 bool NativePanelTestingGtk::IsWindowSizeKnown() const { |
| 748 return panel_browser_window_gtk_->window_size_known_; | 757 return panel_browser_window_gtk_->window_size_known_; |
| 749 } | 758 } |
| 750 | 759 |
| 751 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 760 bool NativePanelTestingGtk::IsAnimatingBounds() const { |
| 752 return panel_browser_window_gtk_->IsAnimatingBounds(); | 761 return panel_browser_window_gtk_->IsAnimatingBounds(); |
| 753 } | 762 } |
| OLD | NEW |