Chromium Code Reviews| Index: chrome/browser/ui/panels/panel_browser_view.cc |
| =================================================================== |
| --- chrome/browser/ui/panels/panel_browser_view.cc (revision 94932) |
| +++ chrome/browser/ui/panels/panel_browser_view.cc (working copy) |
| @@ -86,6 +86,8 @@ |
| void PanelBrowserView::SetBounds(const gfx::Rect& bounds) { |
| bounds_ = bounds; |
| + if (panel_->expansion_state() == Panel::EXPANDED) |
| + original_height_ = bounds.height(); |
| //// No animation if the panel is being dragged. |
| if (mouse_dragging_) { |
| @@ -177,10 +179,36 @@ |
| ShowInactive(); |
| } |
| +gfx::Rect PanelBrowserView::GetPanelRestoredBounds() const { |
| + if (panel_->expansion_state() == Panel::EXPANDED) |
| + return bounds_; |
| + |
| + gfx::Rect bounds(bounds_); |
| + bounds.set_height(original_height_); |
| + return bounds; |
| +} |
| + |
| gfx::Rect PanelBrowserView::GetPanelBounds() const { |
| return bounds_; |
| } |
| +void PanelBrowserView::SetPanelRestoredBounds(const gfx::Rect& bounds) { |
| + if (panel_->expansion_state() == Panel::EXPANDED) { |
| + SetBounds(bounds); |
| + return; |
| + } |
| + |
| + // We only allow changing width and height. |
| + original_height_ = bounds.height(); |
| + |
| + if (bounds.width() != bounds_.width()) { |
|
Dmitry Titov
2011/08/05 19:02:20
This calc should be in PanelManager, and it will b
jianli
2011/08/09 19:56:16
Done.
|
| + gfx::Rect new_bounds(bounds_); |
| + new_bounds.set_x(bounds_.x() + bounds_.width() - bounds.width()); |
| + new_bounds.set_width(bounds.width()); |
| + SetBounds(new_bounds); |
| + } |
| +} |
| + |
| void PanelBrowserView::SetPanelBounds(const gfx::Rect& bounds) { |
| SetBounds(bounds); |
| } |
| @@ -297,6 +325,10 @@ |
| GetFrameView()->SchedulePaint(); |
| } |
| +gfx::Size PanelBrowserView::GetNonClientAreaSize() const { |
| + return GetFrameView()->NonClientAreaSize(); |
| +} |
| + |
| Browser* PanelBrowserView::GetPanelBrowser() const { |
| return browser(); |
| } |