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

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

Issue 1927002: Hiding status area on welcome screen. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: nit fixes Created 10 years, 7 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
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 #include <signal.h> 8 #include <signal.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 NotificationService::AllSources(), 73 NotificationService::AllSources(),
74 NotificationService::NoDetails()); 74 NotificationService::NoDetails());
75 } 75 }
76 76
77 bool AcceleratorPressed(const views::Accelerator& accel) { 77 bool AcceleratorPressed(const views::Accelerator& accel) {
78 WizardController* controller = WizardController::default_controller(); 78 WizardController* controller = WizardController::default_controller();
79 if (!controller) 79 if (!controller)
80 return false; 80 return false;
81 81
82 if (accel == accel_account_screen_) { 82 if (accel == accel_account_screen_) {
83 controller->SetCurrentScreen(controller->GetAccountScreen()); 83 controller->ShowAccountScreen();
84 } else if (accel == accel_login_screen_) { 84 } else if (accel == accel_login_screen_) {
85 controller->SetCurrentScreen(controller->GetLoginScreen()); 85 controller->ShowLoginScreen();
86 } else if (accel == accel_network_screen_) { 86 } else if (accel == accel_network_screen_) {
87 controller->SetCurrentScreen(controller->GetNetworkScreen()); 87 controller->ShowNetworkScreen();
88 } else if (accel == accel_update_screen_) { 88 } else if (accel == accel_update_screen_) {
89 controller->SetCurrentScreen(controller->GetUpdateScreen()); 89 controller->ShowUpdateScreen();
90 } else { 90 } else {
91 return false; 91 return false;
92 } 92 }
93 93
94 return true; 94 return true;
95 } 95 }
96 96
97 void PaintBackground(gfx::Canvas* canvas) { 97 void PaintBackground(gfx::Canvas* canvas) {
98 if (painter_.get()) { 98 if (painter_.get()) {
99 // TODO(sky): nuke this once new login manager is in place. This needs to 99 // TODO(sky): nuke this once new login manager is in place. This needs to
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 account_screen_.reset(new chromeos::AccountScreen(this)); 262 account_screen_.reset(new chromeos::AccountScreen(this));
263 return account_screen_.get(); 263 return account_screen_.get();
264 } 264 }
265 265
266 chromeos::UpdateScreen* WizardController::GetUpdateScreen() { 266 chromeos::UpdateScreen* WizardController::GetUpdateScreen() {
267 if (!update_screen_.get()) 267 if (!update_screen_.get())
268 update_screen_.reset(new chromeos::UpdateScreen(this)); 268 update_screen_.reset(new chromeos::UpdateScreen(this));
269 return update_screen_.get(); 269 return update_screen_.get();
270 } 270 }
271 271
272 void WizardController::SetCurrentScreen(WizardScreen* new_current) { 272 void WizardController::ShowNetworkScreen() {
273 if (current_screen_) 273 background_view_->SetStatusAreaVisible(false);
274 current_screen_->Hide(); 274 SetCurrentScreen(GetNetworkScreen());
275 current_screen_ = new_current; 275 }
276 if (current_screen_) { 276
277 current_screen_->Show(); 277 void WizardController::ShowLoginScreen() {
278 contents_->Layout(); 278 background_view_->SetStatusAreaVisible(true);
279 } 279 SetCurrentScreen(GetLoginScreen());
280 contents_->SchedulePaint(); 280 }
281
282 void WizardController::ShowAccountScreen() {
283 background_view_->SetStatusAreaVisible(true);
284 SetCurrentScreen(GetAccountScreen());
285 }
286
287 void WizardController::ShowUpdateScreen() {
288 background_view_->SetStatusAreaVisible(true);
289 SetCurrentScreen(GetUpdateScreen());
281 } 290 }
282 291
283 /////////////////////////////////////////////////////////////////////////////// 292 ///////////////////////////////////////////////////////////////////////////////
284 // WizardController, ExitHandlers: 293 // WizardController, ExitHandlers:
285 void WizardController::OnLoginSignInSelected() { 294 void WizardController::OnLoginSignInSelected() {
286 // We're on the stack, so don't try and delete us now. 295 // We're on the stack, so don't try and delete us now.
287 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 296 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
288 } 297 }
289 298
290 void WizardController::OnLoginCreateAccount() { 299 void WizardController::OnLoginCreateAccount() {
291 SetCurrentScreen(GetAccountScreen()); 300 ShowAccountScreen();
292 } 301 }
293 302
294 void WizardController::OnNetworkConnected() { 303 void WizardController::OnNetworkConnected() {
295 if (is_out_of_box_) { 304 if (is_out_of_box_) {
296 SetCurrentScreen(GetUpdateScreen()); 305 ShowUpdateScreen();
297 update_screen_->StartUpdate(); 306 GetUpdateScreen()->StartUpdate();
298 } else { 307 } else {
299 SetCurrentScreen(GetLoginScreen()); 308 ShowLoginScreen();
300 } 309 }
301 } 310 }
302 311
303 void WizardController::OnNetworkOffline() { 312 void WizardController::OnNetworkOffline() {
304 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and 313 // TODO(dpolukhin): if(is_out_of_box_) we cannot work offline and
305 // should report some error message here and stay on the same screen. 314 // should report some error message here and stay on the same screen.
306 SetCurrentScreen(GetLoginScreen()); 315 ShowLoginScreen();
307 } 316 }
308 317
309 void WizardController::OnAccountCreateBack() { 318 void WizardController::OnAccountCreateBack() {
310 SetCurrentScreen(GetLoginScreen()); 319 ShowLoginScreen();
311 } 320 }
312 321
313 void WizardController::OnAccountCreated() { 322 void WizardController::OnAccountCreated() {
323 ShowLoginScreen();
314 LoginScreen* login = GetLoginScreen(); 324 LoginScreen* login = GetLoginScreen();
315 SetCurrentScreen(login);
316 if (!username_.empty()) { 325 if (!username_.empty()) {
317 login->view()->SetUsername(username_); 326 login->view()->SetUsername(username_);
318 if (!password_.empty()) { 327 if (!password_.empty()) {
319 login->view()->SetPassword(password_); 328 login->view()->SetPassword(password_);
320 // TODO(dpolukhin): clear password memory for real. Now it is not 329 // TODO(dpolukhin): clear password memory for real. Now it is not
321 // a problem becuase we can't extract password from the form. 330 // a problem becuase we can't extract password from the form.
322 password_.clear(); 331 password_.clear();
323 login->view()->Login(); 332 login->view()->Login();
324 } 333 }
325 } 334 }
326 } 335 }
327 336
328 void WizardController::OnConnectionFailed() { 337 void WizardController::OnConnectionFailed() {
329 // TODO(dpolukhin): show error message before going back to network screen. 338 // TODO(dpolukhin): show error message before going back to network screen.
330 is_out_of_box_ = false; 339 is_out_of_box_ = false;
331 SetCurrentScreen(GetNetworkScreen()); 340 ShowNetworkScreen();
332 } 341 }
333 342
334 void WizardController::OnUpdateCompleted() { 343 void WizardController::OnUpdateCompleted() {
335 SetCurrentScreen(GetLoginScreen()); 344 ShowLoginScreen();
336 } 345 }
337 346
338 void WizardController::OnUpdateNetworkError() { 347 void WizardController::OnUpdateNetworkError() {
339 // If network connection got interrupted while downloading the update, 348 // If network connection got interrupted while downloading the update,
340 // return to network selection screen. 349 // return to network selection screen.
341 // TODO(nkostylev): Show message to the user explaining update error. 350 // TODO(nkostylev): Show message to the user explaining update error.
342 SetCurrentScreen(GetNetworkScreen()); 351 ShowNetworkScreen();
343 } 352 }
344 353
345 /////////////////////////////////////////////////////////////////////////////// 354 ///////////////////////////////////////////////////////////////////////////////
346 // WizardController, private: 355 // WizardController, private:
347 356
357 void WizardController::SetCurrentScreen(WizardScreen* new_current) {
358 if (current_screen_)
359 current_screen_->Hide();
360 current_screen_ = new_current;
361 if (current_screen_) {
362 current_screen_->Show();
363 contents_->Layout();
364 }
365 contents_->SchedulePaint();
366 }
367
348 void WizardController::OnSetUserNamePassword(const std::string& username, 368 void WizardController::OnSetUserNamePassword(const std::string& username,
349 const std::string& password) { 369 const std::string& password) {
350 username_ = username; 370 username_ = username;
351 password_ = password; 371 password_ = password;
352 } 372 }
353 373
354 void WizardController::ShowFirstScreen(const std::string& first_screen_name) { 374 void WizardController::ShowFirstScreen(const std::string& first_screen_name) {
355 if (first_screen_name == kNetworkScreenName) { 375 if (first_screen_name == kNetworkScreenName) {
356 SetCurrentScreen(GetNetworkScreen()); 376 ShowNetworkScreen();
357 } else if (first_screen_name == kLoginScreenName) { 377 } else if (first_screen_name == kLoginScreenName) {
358 SetCurrentScreen(GetLoginScreen()); 378 ShowLoginScreen();
359 } else if (first_screen_name == kAccountScreenName) { 379 } else if (first_screen_name == kAccountScreenName) {
360 SetCurrentScreen(GetAccountScreen()); 380 ShowAccountScreen();
361 } else if (first_screen_name == kUpdateScreenName) { 381 } else if (first_screen_name == kUpdateScreenName) {
362 SetCurrentScreen(GetUpdateScreen()); 382 ShowUpdateScreen();
363 update_screen_->StartUpdate(); 383 GetUpdateScreen()->StartUpdate();
364 } else if (first_screen_name != kTestNoScreenName) { 384 } else if (first_screen_name != kTestNoScreenName) {
365 if (is_out_of_box_) { 385 if (is_out_of_box_) {
366 SetCurrentScreen(GetNetworkScreen()); 386 ShowNetworkScreen();
367 } else { 387 } else {
368 SetCurrentScreen(GetLoginScreen()); 388 ShowLoginScreen();
369 } 389 }
370 } 390 }
371 } 391 }
372 392
373 /////////////////////////////////////////////////////////////////////////////// 393 ///////////////////////////////////////////////////////////////////////////////
374 // WizardController, chromeos::ScreenObserver overrides: 394 // WizardController, chromeos::ScreenObserver overrides:
375 void WizardController::OnExit(ExitCodes exit_code) { 395 void WizardController::OnExit(ExitCodes exit_code) {
376 switch (exit_code) { 396 switch (exit_code) {
377 case LOGIN_SIGN_IN_SELECTED: 397 case LOGIN_SIGN_IN_SELECTED:
378 OnLoginSignInSelected(); 398 OnLoginSignInSelected();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 461
442 WizardController* controller = new WizardController(); 462 WizardController* controller = new WizardController();
443 controller->ShowBackground(screen_bounds); 463 controller->ShowBackground(screen_bounds);
444 controller->Init(first_screen_name, screen_bounds, true); 464 controller->Init(first_screen_name, screen_bounds, true);
445 controller->Show(); 465 controller->Show();
446 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) 466 if (chromeos::CrosLibrary::Get()->EnsureLoaded())
447 chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); 467 chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady();
448 } 468 }
449 469
450 } // namespace browser 470 } // namespace browser
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698