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

Unified Diff: chrome/browser/views/constrained_window_impl.cc

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 months 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/views/constrained_window_impl.cc
===================================================================
--- chrome/browser/views/constrained_window_impl.cc (revision 3391)
+++ chrome/browser/views/constrained_window_impl.cc (working copy)
@@ -217,7 +217,7 @@
// Overridden from ChromeViews::View:
virtual void Paint(ChromeCanvas* canvas);
virtual void Layout();
- virtual void GetPreferredSize(CSize* out);
+ virtual gfx::Size GetPreferredSize();
virtual void ViewHierarchyChanged(bool is_add, View *parent, View *child);
// Overridden from ChromeViews::BaseButton::ButtonListener:
@@ -425,12 +425,8 @@
int ConstrainedWindowNonClientView::CalculateNonClientHeight(
bool with_url_field) const {
int r = CalculateTitlebarHeight();
-
- if (with_url_field) {
- CSize s;
- location_bar_->GetPreferredSize(&s);
- r += s.cy;
- }
+ if (with_url_field)
+ r += location_bar_->GetPreferredSize().height();
return r;
}
@@ -572,15 +568,15 @@
}
int location_bar_height = 0;
- CSize ps;
+ gfx::Size ps;
if (should_display_url_field) {
- location_bar_->GetPreferredSize(&ps);
- location_bar_height = ps.cy;
+ ps = location_bar_->GetPreferredSize();
+ location_bar_height = ps.height();
}
- close_button_->GetPreferredSize(&ps);
- close_button_->SetBounds(width() - ps.cx - kWindowControlsRightOffset,
- kWindowControlsTopOffset, ps.cx, ps.cy);
+ ps = close_button_->GetPreferredSize();
+ close_button_->SetBounds(width() - ps.width() - kWindowControlsRightOffset,
+ kWindowControlsTopOffset, ps.width(), ps.height());
int titlebar_height = CalculateTitlebarHeight();
if (window_delegate_) {
@@ -620,12 +616,12 @@
container_->client_view()->SetBounds(client_bounds_.ToRECT());
}
-void ConstrainedWindowNonClientView::GetPreferredSize(CSize* out) {
- DCHECK(out);
- container_->client_view()->GetPreferredSize(out);
- out->cx += 2 * kWindowHorizontalBorderSize;
- out->cy += CalculateNonClientHeight(ShouldDisplayURLField()) +
- kWindowVerticalBorderSize;
+gfx::Size ConstrainedWindowNonClientView::GetPreferredSize() {
+ gfx::Size prefsize = container_->client_view()->GetPreferredSize();
+ prefsize.Enlarge(2 * kWindowHorizontalBorderSize,
+ CalculateNonClientHeight(ShouldDisplayURLField()) +
+ kWindowVerticalBorderSize);
+ return prefsize;
}
void ConstrainedWindowNonClientView::ViewHierarchyChanged(bool is_add,

Powered by Google App Engine
This is Rietveld 408576698