| OLD | NEW |
| 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 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/logging.h" // For NOTREACHED. | 16 #include "base/logging.h" // For NOTREACHED. |
| 17 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 18 #include "chrome/browser/chromeos/cros/login_library.h" | 18 #include "chrome/browser/chromeos/cros/login_library.h" |
| 19 #include "chrome/browser/chromeos/customization_document.h" |
| 19 #include "chrome/browser/chromeos/login/account_screen.h" | 20 #include "chrome/browser/chromeos/login/account_screen.h" |
| 20 #include "chrome/browser/chromeos/login/background_view.h" | 21 #include "chrome/browser/chromeos/login/background_view.h" |
| 21 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 22 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 22 #include "chrome/browser/chromeos/login/login_screen.h" | 23 #include "chrome/browser/chromeos/login/login_screen.h" |
| 23 #include "chrome/browser/chromeos/login/network_screen.h" | 24 #include "chrome/browser/chromeos/login/network_screen.h" |
| 24 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" | 25 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 25 #include "chrome/browser/chromeos/login/update_screen.h" | 26 #include "chrome/browser/chromeos/login/update_screen.h" |
| 26 #include "chrome/browser/chromeos/login/user_manager.h" | 27 #include "chrome/browser/chromeos/login/user_manager.h" |
| 27 #include "chrome/browser/chromeos/wm_ipc.h" | 28 #include "chrome/browser/chromeos/wm_ipc.h" |
| 28 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 157 |
| 157 // Special test value that commands not to create any window yet. | 158 // Special test value that commands not to create any window yet. |
| 158 const char WizardController::kTestNoScreenName[] = "test:nowindow"; | 159 const char WizardController::kTestNoScreenName[] = "test:nowindow"; |
| 159 | 160 |
| 160 // Initialize default controller. | 161 // Initialize default controller. |
| 161 // static | 162 // static |
| 162 WizardController* WizardController::default_controller_ = NULL; | 163 WizardController* WizardController::default_controller_ = NULL; |
| 163 | 164 |
| 164 /////////////////////////////////////////////////////////////////////////////// | 165 /////////////////////////////////////////////////////////////////////////////// |
| 165 // WizardController, public: | 166 // WizardController, public: |
| 167 |
| 166 WizardController::WizardController() | 168 WizardController::WizardController() |
| 167 : widget_(NULL), | 169 : widget_(NULL), |
| 168 background_widget_(NULL), | 170 background_widget_(NULL), |
| 169 background_view_(NULL), | 171 background_view_(NULL), |
| 170 contents_(NULL), | 172 contents_(NULL), |
| 171 current_screen_(NULL), | 173 current_screen_(NULL), |
| 172 is_out_of_box_(false), | 174 is_out_of_box_(false), |
| 173 observer_(NULL) { | 175 observer_(NULL) { |
| 174 DCHECK(default_controller_ == NULL); | 176 DCHECK(default_controller_ == NULL); |
| 175 default_controller_ = this; | 177 default_controller_ = this; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 293 } |
| 292 | 294 |
| 293 void WizardController::SetStatusAreaVisible(bool visible) { | 295 void WizardController::SetStatusAreaVisible(bool visible) { |
| 294 // When ExistingUserController passes background ownership | 296 // When ExistingUserController passes background ownership |
| 295 // to WizardController it happens after screen is shown. | 297 // to WizardController it happens after screen is shown. |
| 296 if (background_view_) { | 298 if (background_view_) { |
| 297 background_view_->SetStatusAreaVisible(visible); | 299 background_view_->SetStatusAreaVisible(visible); |
| 298 } | 300 } |
| 299 } | 301 } |
| 300 | 302 |
| 303 void WizardController::SetCustomization( |
| 304 const chromeos::StartupCustomizationDocument* customization) { |
| 305 customization_.reset(customization); |
| 306 } |
| 307 |
| 301 /////////////////////////////////////////////////////////////////////////////// | 308 /////////////////////////////////////////////////////////////////////////////// |
| 302 // WizardController, ExitHandlers: | 309 // WizardController, ExitHandlers: |
| 303 void WizardController::OnLoginSignInSelected() { | 310 void WizardController::OnLoginSignInSelected() { |
| 304 // We're on the stack, so don't try and delete us now. | 311 // We're on the stack, so don't try and delete us now. |
| 305 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 312 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 306 } | 313 } |
| 307 | 314 |
| 308 void WizardController::OnLoginCreateAccount() { | 315 void WizardController::OnLoginCreateAccount() { |
| 309 ShowAccountScreen(); | 316 ShowAccountScreen(); |
| 310 } | 317 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 switches::kEnableLoginImages)) { | 474 switches::kEnableLoginImages)) { |
| 468 std::vector<chromeos::UserManager::User> users = | 475 std::vector<chromeos::UserManager::User> users = |
| 469 chromeos::UserManager::Get()->GetUsers(); | 476 chromeos::UserManager::Get()->GetUsers(); |
| 470 if (!users.empty()) { | 477 if (!users.empty()) { |
| 471 // ExistingUserController deletes itself. | 478 // ExistingUserController deletes itself. |
| 472 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); | 479 (new chromeos::ExistingUserController(users, screen_bounds))->Init(); |
| 473 return; | 480 return; |
| 474 } | 481 } |
| 475 } | 482 } |
| 476 | 483 |
| 484 // Load partner customization startup manifest if needed. |
| 485 scoped_ptr<chromeos::StartupCustomizationDocument> customization; |
| 486 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 487 switches::kStartupManifest)) { |
| 488 customization.reset(new chromeos::StartupCustomizationDocument()); |
| 489 FilePath manifest_path = |
| 490 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 491 switches::kStartupManifest); |
| 492 bool manifest_loaded = customization->LoadManifestFromFile(manifest_path); |
| 493 DCHECK(manifest_loaded) << manifest_path.value(); |
| 494 } |
| 495 |
| 496 // Create and show the wizard. |
| 477 WizardController* controller = new WizardController(); | 497 WizardController* controller = new WizardController(); |
| 498 controller->SetCustomization(customization.release()); |
| 478 controller->ShowBackground(screen_bounds); | 499 controller->ShowBackground(screen_bounds); |
| 479 controller->Init(first_screen_name, screen_bounds, true); | 500 controller->Init(first_screen_name, screen_bounds, true); |
| 480 controller->Show(); | 501 controller->Show(); |
| 481 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) | 502 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) |
| 482 chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); | 503 chromeos::CrosLibrary::Get()->GetLoginLibrary()->EmitLoginPromptReady(); |
| 483 } | 504 } |
| 484 | 505 |
| 485 } // namespace browser | 506 } // namespace browser |
| OLD | NEW |