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

Side by Side Diff: chrome/browser/chromeos/login/background_view.cc

Issue 8436002: [cros] Remove Views implementation for login/OOBE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 1 month 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) 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/chromeos/login/background_view.h" 5 #include "chrome/browser/chromeos/login/background_view.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/login/login_utils.h" 15 #include "chrome/browser/chromeos/login/login_utils.h"
16 #include "chrome/browser/chromeos/login/oobe_progress_bar.h"
17 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h" 16 #include "chrome/browser/chromeos/login/proxy_settings_dialog.h"
18 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" 17 #include "chrome/browser/chromeos/login/rounded_rect_painter.h"
19 #include "chrome/browser/chromeos/login/shutdown_button.h" 18 #include "chrome/browser/chromeos/login/shutdown_button.h"
20 #include "chrome/browser/chromeos/login/wizard_controller.h" 19 #include "chrome/browser/chromeos/login/wizard_controller.h"
21 #include "chrome/browser/policy/browser_policy_connector.h" 20 #include "chrome/browser/policy/browser_policy_connector.h"
22 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/ui/views/dom_view.h" 22 #include "chrome/browser/ui/views/dom_view.h"
24 #include "chrome/browser/ui/views/window.h" 23 #include "chrome/browser/ui/views/window.h"
25 #include "chrome/common/chrome_version_info.h" 24 #include "chrome/common/chrome_version_info.h"
26 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 namespace chromeos { 72 namespace chromeos {
74 73
75 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
76 // BackgroundView public: 75 // BackgroundView public:
77 76
78 BackgroundView::BackgroundView() 77 BackgroundView::BackgroundView()
79 : status_area_(NULL), 78 : status_area_(NULL),
80 screen_mode_(StatusAreaViewChromeos::LOGIN_MODE_VIEWS), 79 screen_mode_(StatusAreaViewChromeos::LOGIN_MODE_VIEWS),
81 os_version_label_(NULL), 80 os_version_label_(NULL),
82 boot_times_label_(NULL), 81 boot_times_label_(NULL),
83 progress_bar_(NULL),
84 shutdown_button_(NULL), 82 shutdown_button_(NULL),
85 #if defined(OFFICIAL_BUILD) 83 #if defined(OFFICIAL_BUILD)
86 is_official_build_(true), 84 is_official_build_(true),
87 #else 85 #else
88 is_official_build_(false), 86 is_official_build_(false),
89 #endif 87 #endif
90 background_area_(NULL), 88 background_area_(NULL),
91 version_info_updater_(this) { 89 version_info_updater_(this) {
92 } 90 }
93 91
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 164 }
167 165
168 void BackgroundView::SetStatusAreaVisible(bool visible) { 166 void BackgroundView::SetStatusAreaVisible(bool visible) {
169 status_area_->SetVisible(visible); 167 status_area_->SetVisible(visible);
170 } 168 }
171 169
172 void BackgroundView::SetStatusAreaEnabled(bool enable) { 170 void BackgroundView::SetStatusAreaEnabled(bool enable) {
173 status_area_->MakeButtonsActive(enable); 171 status_area_->MakeButtonsActive(enable);
174 } 172 }
175 173
176 void BackgroundView::SetOobeProgressBarVisible(bool visible) {
177 if (!progress_bar_ && visible)
178 InitProgressBar();
179
180 if (progress_bar_)
181 progress_bar_->SetVisible(visible);
182 }
183
184 bool BackgroundView::IsOobeProgressBarVisible() {
185 return progress_bar_ && progress_bar_->IsVisible();
186 }
187
188 void BackgroundView::SetOobeProgress(LoginStep step) {
189 DCHECK(step < STEPS_COUNT);
190 if (progress_bar_)
191 progress_bar_->SetStep(GetStepId(step));
192 }
193
194 void BackgroundView::ShowScreenSaver() { 174 void BackgroundView::ShowScreenSaver() {
195 SetStatusAreaVisible(false); 175 SetStatusAreaVisible(false);
196 background_area_->SetVisible(true); 176 background_area_->SetVisible(true);
197 } 177 }
198 178
199 void BackgroundView::HideScreenSaver() { 179 void BackgroundView::HideScreenSaver() {
200 SetStatusAreaVisible(true); 180 SetStatusAreaVisible(true);
201 // TODO(oshima): we need a way to suspend screen saver 181 // TODO(oshima): we need a way to suspend screen saver
202 // to save power when it's not visible. 182 // to save power when it's not visible.
203 background_area_->SetVisible(false); 183 background_area_->SetVisible(false);
(...skipping 13 matching lines...) Expand all
217 } 197 }
218 198
219 /////////////////////////////////////////////////////////////////////////////// 199 ///////////////////////////////////////////////////////////////////////////////
220 // BackgroundView protected: 200 // BackgroundView protected:
221 201
222 void BackgroundView::Layout() { 202 void BackgroundView::Layout() {
223 const int kCornerPadding = 5; 203 const int kCornerPadding = 5;
224 const int kInfoLeftPadding = 10; 204 const int kInfoLeftPadding = 10;
225 const int kInfoBottomPadding = 10; 205 const int kInfoBottomPadding = 10;
226 const int kInfoBetweenLinesPadding = 1; 206 const int kInfoBetweenLinesPadding = 1;
227 const int kProgressBarBottomPadding = 20;
228 const int kProgressBarWidth = 750;
229 const int kProgressBarHeight = 70;
230 gfx::Size status_area_size = status_area_->GetPreferredSize(); 207 gfx::Size status_area_size = status_area_->GetPreferredSize();
231 status_area_->SetBounds( 208 status_area_->SetBounds(
232 width() - status_area_size.width() - kCornerPadding, 209 width() - status_area_size.width() - kCornerPadding,
233 kCornerPadding, 210 kCornerPadding,
234 status_area_size.width(), 211 status_area_size.width(),
235 status_area_size.height()); 212 status_area_size.height());
236 gfx::Size version_size = os_version_label_->GetPreferredSize(); 213 gfx::Size version_size = os_version_label_->GetPreferredSize();
237 int os_version_y = height() - version_size.height() - kInfoBottomPadding; 214 int os_version_y = height() - version_size.height() - kInfoBottomPadding;
238 if (!is_official_build_) 215 if (!is_official_build_)
239 os_version_y -= (version_size.height() + kInfoBetweenLinesPadding); 216 os_version_y -= (version_size.height() + kInfoBetweenLinesPadding);
240 os_version_label_->SetBounds( 217 os_version_label_->SetBounds(
241 kInfoLeftPadding, 218 kInfoLeftPadding,
242 os_version_y, 219 os_version_y,
243 width() - 2 * kInfoLeftPadding, 220 width() - 2 * kInfoLeftPadding,
244 version_size.height()); 221 version_size.height());
245 if (!is_official_build_) { 222 if (!is_official_build_) {
246 boot_times_label_->SetBounds( 223 boot_times_label_->SetBounds(
247 kInfoLeftPadding, 224 kInfoLeftPadding,
248 height() - (version_size.height() + kInfoBottomPadding), 225 height() - (version_size.height() + kInfoBottomPadding),
249 width() - 2 * kInfoLeftPadding, 226 width() - 2 * kInfoLeftPadding,
250 version_size.height()); 227 version_size.height());
251 } 228 }
252 if (progress_bar_) {
253 progress_bar_->SetBounds(
254 (width() - kProgressBarWidth) / 2,
255 (height() - kProgressBarBottomPadding - kProgressBarHeight),
256 kProgressBarWidth,
257 kProgressBarHeight);
258 }
259 if (shutdown_button_) { 229 if (shutdown_button_) {
260 shutdown_button_->LayoutIn(this); 230 shutdown_button_->LayoutIn(this);
261 } 231 }
262 if (background_area_) 232 if (background_area_)
263 background_area_->SetBoundsRect(this->bounds()); 233 background_area_->SetBoundsRect(this->bounds());
264 } 234 }
265 235
266 void BackgroundView::ChildPreferredSizeChanged(View* child) { 236 void BackgroundView::ChildPreferredSizeChanged(View* child) {
267 Layout(); 237 Layout();
268 SchedulePaint(); 238 SchedulePaint();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont)); 325 boot_times_label_->SetFont(rb.GetFont(ResourceBundle::SmallFont));
356 if (idx < 0) 326 if (idx < 0)
357 AddChildView(boot_times_label_); 327 AddChildView(boot_times_label_);
358 else 328 else
359 AddChildViewAt(boot_times_label_, idx); 329 AddChildViewAt(boot_times_label_, idx);
360 } 330 }
361 331
362 version_info_updater_.StartUpdate(is_official_build_); 332 version_info_updater_.StartUpdate(is_official_build_);
363 } 333 }
364 334
365 void BackgroundView::InitProgressBar() {
366 std::vector<int> steps;
367 steps.push_back(GetStepId(SELECT_NETWORK));
368 #if defined(OFFICIAL_BUILD)
369 steps.push_back(GetStepId(EULA));
370 #endif
371 steps.push_back(GetStepId(SIGNIN));
372 #if defined(OFFICIAL_BUILD)
373 if (WizardController::IsRegisterScreenDefined())
374 steps.push_back(GetStepId(REGISTRATION));
375 #endif
376 steps.push_back(GetStepId(PICTURE));
377 progress_bar_ = new OobeProgressBar(steps);
378 AddChildView(progress_bar_);
379 }
380
381 void BackgroundView::UpdateWindowType() { 335 void BackgroundView::UpdateWindowType() {
382 #if defined(TOOLKIT_USES_GTK) 336 #if defined(TOOLKIT_USES_GTK)
383 std::vector<int> params; 337 std::vector<int> params;
384 WmIpc::instance()->SetWindowType( 338 WmIpc::instance()->SetWindowType(
385 GTK_WIDGET(GetNativeWindow()), 339 GTK_WIDGET(GetNativeWindow()),
386 WM_IPC_WINDOW_LOGIN_BACKGROUND, 340 WM_IPC_WINDOW_LOGIN_BACKGROUND,
387 &params); 341 &params);
388 #endif 342 #endif
389 } 343 }
390 344
391 } // namespace chromeos 345 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/background_view.h ('k') | chrome/browser/chromeos/login/base_login_display_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698