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

Side by Side Diff: chrome/browser/views/first_run_view_base.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/first_run_view_base.h" 5 #include "chrome/browser/views/first_run_view_base.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 static_cast<int>(sub_view_bounds.right()) + kPanelHorizMargin); 114 static_cast<int>(sub_view_bounds.right()) + kPanelHorizMargin);
115 } 115 }
116 116
117 void FirstRunViewBase::SetMinimumDialogWidth(int width) { 117 void FirstRunViewBase::SetMinimumDialogWidth(int width) {
118 preferred_width_ = std::max(preferred_width_, width); 118 preferred_width_ = std::max(preferred_width_, width);
119 } 119 }
120 120
121 void FirstRunViewBase::Layout() { 121 void FirstRunViewBase::Layout() {
122 const int kVertSpacing = 8; 122 const int kVertSpacing = 8;
123 123
124 CSize canvas; 124 gfx::Size canvas = GetPreferredSize();
125 GetPreferredSize(&canvas);
126 125
127 CSize pref_size; 126 gfx::Size pref_size = background_image_->GetPreferredSize();
128 background_image_->GetPreferredSize(&pref_size); 127 background_image_->SetBounds(0, 0, canvas.width(), pref_size.height());
129 background_image_->SetBounds(0, 0, canvas.cx, pref_size.cy);
130 128
131 int next_v_space = background_image_->y() + 129 int next_v_space = background_image_->y() +
132 background_image_->height() - 2; 130 background_image_->height() - 2;
133 131
134 separator_1_->GetPreferredSize(&pref_size); 132 pref_size = separator_1_->GetPreferredSize();
135 separator_1_->SetBounds(0 , next_v_space, canvas.cx + 1, pref_size.cy); 133 separator_1_->SetBounds(0, next_v_space, canvas.width() + 1,
134 pref_size.height());
136 135
137 next_v_space = canvas.cy - kPanelSubVerticalSpacing - 2 * kVertSpacing; 136 next_v_space = canvas.height() - kPanelSubVerticalSpacing - 2 * kVertSpacing;
138 separator_2_->GetPreferredSize(&pref_size); 137 pref_size = separator_2_->GetPreferredSize();
139 separator_2_->SetBounds(kPanelHorizMargin , next_v_space, 138 separator_2_->SetBounds(kPanelHorizMargin , next_v_space,
140 canvas.cx - 2 * kPanelHorizMargin, pref_size.cy); 139 canvas.width() - 2 * kPanelHorizMargin,
140 pref_size.height());
141 141
142 next_v_space = separator_2_->y() + separator_2_->height() + kVertSpacing; 142 next_v_space = separator_2_->y() + separator_2_->height() + kVertSpacing;
143 143
144 int width = canvas.cx - 2 * kPanelHorizMargin; 144 int width = canvas.width() - 2 * kPanelHorizMargin;
145 int height = default_browser_->GetHeightForWidth(width); 145 int height = default_browser_->GetHeightForWidth(width);
146 default_browser_->SetBounds(kPanelHorizMargin, next_v_space, width, height); 146 default_browser_->SetBounds(kPanelHorizMargin, next_v_space, width, height);
147 AdjustDialogWidth(default_browser_); 147 AdjustDialogWidth(default_browser_);
148 } 148 }
149 149
150 bool FirstRunViewBase::CanResize() const { 150 bool FirstRunViewBase::CanResize() const {
151 return false; 151 return false;
152 } 152 }
153 153
154 bool FirstRunViewBase::CanMaximize() const { 154 bool FirstRunViewBase::CanMaximize() const {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 194 }
195 195
196 bool FirstRunViewBase::SetDefaultBrowser() { 196 bool FirstRunViewBase::SetDefaultBrowser() {
197 UserMetrics::RecordAction(L"FirstRun_Do_DefBrowser", profile_); 197 UserMetrics::RecordAction(L"FirstRun_Do_DefBrowser", profile_);
198 return ShellIntegration::SetAsDefaultBrowser(); 198 return ShellIntegration::SetAsDefaultBrowser();
199 } 199 }
200 200
201 bool FirstRunViewBase::FirstRunComplete() { 201 bool FirstRunViewBase::FirstRunComplete() {
202 return FirstRun::CreateSentinel(); 202 return FirstRun::CreateSentinel();
203 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698