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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DLOG(WARNING) << "Unexpected call to PanelBrowserWindowGtk::SetBounds()"; | 135 DLOG(WARNING) << "Unexpected call to PanelBrowserWindowGtk::SetBounds()"; |
136 } | 136 } |
137 | 137 |
138 void PanelBrowserWindowGtk::OnSizeChanged(int width, int height) { | 138 void PanelBrowserWindowGtk::OnSizeChanged(int width, int height) { |
139 BrowserWindowGtk::OnSizeChanged(width, height); | 139 BrowserWindowGtk::OnSizeChanged(width, height); |
140 | 140 |
141 if (window_size_known_) | 141 if (window_size_known_) |
142 return; | 142 return; |
143 | 143 |
144 window_size_known_ = true; | 144 window_size_known_ = true; |
145 int bottom = panel_->manager()->GetBottomPositionForExpansionState( | 145 int top = bounds_.bottom() - height; |
146 panel_->expansion_state()); | 146 int left = bounds_.right() - width; |
147 int top = bottom - height; | |
148 | 147 |
149 gtk_window_move(window_, bounds_.x(), top); | 148 gtk_window_move(window_, left, top); |
150 StartBoundsAnimation(gfx::Rect(bounds_.x(), top, width, height)); | 149 StartBoundsAnimation(gfx::Rect(left, top, width, height)); |
151 panel_->OnWindowSizeAvailable(); | 150 panel_->OnWindowSizeAvailable(); |
152 | 151 |
153 content::NotificationService::current()->Notify( | 152 content::NotificationService::current()->Notify( |
154 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, | 153 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, |
155 content::Source<Panel>(panel_.get()), | 154 content::Source<Panel>(panel_.get()), |
156 content::NotificationService::NoDetails()); | 155 content::NotificationService::NoDetails()); |
157 } | 156 } |
158 | 157 |
159 bool PanelBrowserWindowGtk::UseCustomFrame() { | 158 bool PanelBrowserWindowGtk::UseCustomFrame() { |
160 // We always use custom frame for panels. | 159 // We always use custom frame for panels. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 } | 727 } |
729 } | 728 } |
730 | 729 |
731 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 730 bool NativePanelTestingGtk::IsWindowSizeKnown() const { |
732 return panel_browser_window_gtk_->window_size_known_; | 731 return panel_browser_window_gtk_->window_size_known_; |
733 } | 732 } |
734 | 733 |
735 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 734 bool NativePanelTestingGtk::IsAnimatingBounds() const { |
736 return panel_browser_window_gtk_->IsAnimatingBounds(); | 735 return panel_browser_window_gtk_->IsAnimatingBounds(); |
737 } | 736 } |
OLD | NEW |