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

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

Issue 6902107: Merge 82987, 83304 - make sure that OEM tab is shown even if first login is Guest (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 years, 8 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) 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/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 "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/chromeos/cros/cros_library.h" 19 #include "chrome/browser/chromeos/cros/cros_library.h"
20 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 20 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
21 #include "chrome/browser/chromeos/customization_document.h" 21 #include "chrome/browser/chromeos/customization_document.h"
22 #include "chrome/browser/chromeos/language_preferences.h" 22 #include "chrome/browser/chromeos/language_preferences.h"
23 #include "chrome/browser/chromeos/login/account_screen.h" 23 #include "chrome/browser/chromeos/login/account_screen.h"
24 #include "chrome/browser/chromeos/login/apply_services_customization.h"
25 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" 24 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h"
26 #include "chrome/browser/chromeos/login/eula_view.h" 25 #include "chrome/browser/chromeos/login/eula_view.h"
27 #include "chrome/browser/chromeos/login/existing_user_controller.h" 26 #include "chrome/browser/chromeos/login/existing_user_controller.h"
28 #include "chrome/browser/chromeos/login/helper.h" 27 #include "chrome/browser/chromeos/login/helper.h"
29 #include "chrome/browser/chromeos/login/html_page_screen.h" 28 #include "chrome/browser/chromeos/login/html_page_screen.h"
30 #include "chrome/browser/chromeos/login/login_display_host.h" 29 #include "chrome/browser/chromeos/login/login_display_host.h"
31 #include "chrome/browser/chromeos/login/login_utils.h" 30 #include "chrome/browser/chromeos/login/login_utils.h"
32 #include "chrome/browser/chromeos/login/network_screen.h" 31 #include "chrome/browser/chromeos/login/network_screen.h"
33 #include "chrome/browser/chromeos/login/registration_screen.h" 32 #include "chrome/browser/chromeos/login/registration_screen.h"
34 #include "chrome/browser/chromeos/login/update_screen.h" 33 #include "chrome/browser/chromeos/login/update_screen.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 views::Accelerator accel_eula_screen_; 170 views::Accelerator accel_eula_screen_;
172 views::Accelerator accel_register_screen_; 171 views::Accelerator accel_register_screen_;
173 views::Accelerator accel_enterprise_enrollment_screen_; 172 views::Accelerator accel_enterprise_enrollment_screen_;
174 #endif 173 #endif
175 views::Accelerator accel_toggle_accessibility_; 174 views::Accelerator accel_toggle_accessibility_;
176 views::Accelerator accel_cancel_update_; 175 views::Accelerator accel_cancel_update_;
177 176
178 DISALLOW_COPY_AND_ASSIGN(ContentView); 177 DISALLOW_COPY_AND_ASSIGN(ContentView);
179 }; 178 };
180 179
181 // Returns true if startup manifest defines valid registration URL.
182 bool IsRegistrationScreenValid(
183 const chromeos::StartupCustomizationDocument* startup_manifest) {
184 return startup_manifest != NULL &&
185 GURL(startup_manifest->registration_url()).is_valid();
186 }
187
188 // Saves boolean "Local State" preference and forces its persistence to disk. 180 // Saves boolean "Local State" preference and forces its persistence to disk.
189 void SaveBoolPreferenceForced(const char* pref_name, bool value) { 181 void SaveBoolPreferenceForced(const char* pref_name, bool value) {
190 PrefService* prefs = g_browser_process->local_state(); 182 PrefService* prefs = g_browser_process->local_state();
191 prefs->SetBoolean(pref_name, value); 183 prefs->SetBoolean(pref_name, value);
192 prefs->SavePersistentPrefs(); 184 prefs->SavePersistentPrefs();
193 } 185 }
194 186
195 // Saves integer "Local State" preference and forces its persistence to disk. 187 // Saves integer "Local State" preference and forces its persistence to disk.
196 void SaveIntegerPreferenceForced(const char* pref_name, int value) { 188 void SaveIntegerPreferenceForced(const char* pref_name, int value) {
197 PrefService* prefs = g_browser_process->local_state(); 189 PrefService* prefs = g_browser_process->local_state();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 259
268 chromeos::WizardAccessibilityHelper::GetInstance()-> 260 chromeos::WizardAccessibilityHelper::GetInstance()->
269 UnregisterNotifications(); 261 UnregisterNotifications();
270 } 262 }
271 263
272 void WizardController::Init(const std::string& first_screen_name) { 264 void WizardController::Init(const std::string& first_screen_name) {
273 VLOG(1) << "Starting OOBE wizard with screen: " << first_screen_name; 265 VLOG(1) << "Starting OOBE wizard with screen: " << first_screen_name;
274 DCHECK(!contents_); 266 DCHECK(!contents_);
275 first_screen_name_ = first_screen_name; 267 first_screen_name_ = first_screen_name;
276 268
277 // When device is not registered yet we need to load startup manifest as well.
278 // In case of OOBE (network-EULA-update) manifest has been loaded in
279 // ShowLoginWizard().
280 if (IsOobeCompleted() && !IsDeviceRegistered())
281 SetCustomization(chromeos::LoadStartupManifest());
282
283 contents_ = new ContentView(); 269 contents_ = new ContentView();
284 270
285 bool oobe_complete = IsOobeCompleted(); 271 bool oobe_complete = IsOobeCompleted();
286 if (!oobe_complete || first_screen_name == kOutOfBoxScreenName) { 272 if (!oobe_complete || first_screen_name == kOutOfBoxScreenName) {
287 is_out_of_box_ = true; 273 is_out_of_box_ = true;
288 } 274 }
289 275
290 ShowFirstScreen(first_screen_name); 276 ShowFirstScreen(first_screen_name);
291 } 277 }
292 278
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void WizardController::ShowEulaScreen() { 394 void WizardController::ShowEulaScreen() {
409 VLOG(1) << "Showing EULA screen."; 395 VLOG(1) << "Showing EULA screen.";
410 SetStatusAreaVisible(false); 396 SetStatusAreaVisible(false);
411 SetCurrentScreen(GetEulaScreen()); 397 SetCurrentScreen(GetEulaScreen());
412 #if defined(OFFICIAL_BUILD) 398 #if defined(OFFICIAL_BUILD)
413 host_->SetOobeProgress(chromeos::BackgroundView::EULA); 399 host_->SetOobeProgress(chromeos::BackgroundView::EULA);
414 #endif 400 #endif
415 } 401 }
416 402
417 void WizardController::ShowRegistrationScreen() { 403 void WizardController::ShowRegistrationScreen() {
418 if (!IsRegistrationScreenValid(GetCustomization())) { 404 if (!IsRegisterScreenDefined()) {
419 VLOG(1) << "Skipping registration screen: manifest not defined or invalid " 405 VLOG(1) << "Skipping registration screen: manifest not defined or invalid "
420 "URL."; 406 "URL.";
421 OnRegistrationSkipped(); 407 OnRegistrationSkipped();
422 return; 408 return;
423 } 409 }
424 VLOG(1) << "Showing registration screen."; 410 VLOG(1) << "Showing registration screen.";
425 SetStatusAreaVisible(true); 411 SetStatusAreaVisible(true);
426 SetCurrentScreen(GetRegistrationScreen()); 412 SetCurrentScreen(GetRegistrationScreen());
427 #if defined(OFFICIAL_BUILD) 413 #if defined(OFFICIAL_BUILD)
428 host_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION); 414 host_->SetOobeProgress(chromeos::BackgroundView::REGISTRATION);
429 #endif 415 #endif
430 } 416 }
431 417
432 void WizardController::ShowHTMLPageScreen() { 418 void WizardController::ShowHTMLPageScreen() {
433 VLOG(1) << "Showing HTML page screen."; 419 VLOG(1) << "Showing HTML page screen.";
434 SetStatusAreaVisible(true); 420 SetStatusAreaVisible(true);
435 host_->SetOobeProgressBarVisible(false); 421 host_->SetOobeProgressBarVisible(false);
436 SetCurrentScreen(GetHTMLPageScreen()); 422 SetCurrentScreen(GetHTMLPageScreen());
437 } 423 }
438 424
439 void WizardController::ShowEnterpriseEnrollmentScreen() { 425 void WizardController::ShowEnterpriseEnrollmentScreen() {
440 SetStatusAreaVisible(true); 426 SetStatusAreaVisible(true);
441 host_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); 427 host_->SetOobeProgress(chromeos::BackgroundView::SIGNIN);
442 SetCurrentScreen(GetEnterpriseEnrollmentScreen()); 428 SetCurrentScreen(GetEnterpriseEnrollmentScreen());
443 } 429 }
444 430
445 void WizardController::SetCustomization(
446 const chromeos::StartupCustomizationDocument* customization) {
447 customization_.reset(customization);
448 }
449
450 const chromeos::StartupCustomizationDocument*
451 WizardController::GetCustomization() const {
452 return customization_.get();
453 }
454
455 void WizardController::SkipRegistration() { 431 void WizardController::SkipRegistration() {
456 if (current_screen_ == GetRegistrationScreen()) 432 if (current_screen_ == GetRegistrationScreen())
457 OnRegistrationSkipped(); 433 OnRegistrationSkipped();
458 else 434 else
459 LOG(ERROR) << "Registration screen is not active."; 435 LOG(ERROR) << "Registration screen is not active.";
460 } 436 }
461 437
462 // static 438 // static
463 void WizardController::RegisterPrefs(PrefService* local_state) { 439 void WizardController::RegisterPrefs(PrefService* local_state) {
464 local_state->RegisterBooleanPref(kOobeComplete, false); 440 local_state->RegisterBooleanPref(kOobeComplete, false);
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 // static 781 // static
806 void WizardController::SetInitialLocale(const std::string& locale) { 782 void WizardController::SetInitialLocale(const std::string& locale) {
807 if (l10n_util::IsValidLocaleSyntax(locale)) 783 if (l10n_util::IsValidLocaleSyntax(locale))
808 SaveStringPreferenceForced(kInitialLocale, locale); 784 SaveStringPreferenceForced(kInitialLocale, locale);
809 else 785 else
810 NOTREACHED(); 786 NOTREACHED();
811 } 787 }
812 788
813 // static 789 // static
814 bool WizardController::IsRegisterScreenDefined() { 790 bool WizardController::IsRegisterScreenDefined() {
815 const chromeos::StartupCustomizationDocument* manifest = NULL; 791 const chromeos::StartupCustomizationDocument* manifest =
816 // This method will be called from ExistingUserController too 792 chromeos::StartupCustomizationDocument::GetInstance();
817 // when Wizard instance doesn't exist. 793 return manifest->IsReady() &&
818 if (default_controller()) 794 GURL(manifest->registration_url()).is_valid();
819 manifest = default_controller()->GetCustomization();
820 else
821 manifest = chromeos::LoadStartupManifest();
822 return IsRegistrationScreenValid(manifest);
823 } 795 }
824 796
825 /////////////////////////////////////////////////////////////////////////////// 797 ///////////////////////////////////////////////////////////////////////////////
826 // WizardController, chromeos::ScreenObserver overrides: 798 // WizardController, chromeos::ScreenObserver overrides:
827 void WizardController::OnExit(ExitCodes exit_code) { 799 void WizardController::OnExit(ExitCodes exit_code) {
828 LOG(INFO) << "Wizard screen exit code: " << exit_code; 800 LOG(INFO) << "Wizard screen exit code: " << exit_code;
829 switch (exit_code) { 801 switch (exit_code) {
830 case NETWORK_CONNECTED: 802 case NETWORK_CONNECTED:
831 OnNetworkConnected(); 803 OnNetworkConnected();
832 break; 804 break;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 return contents_; 863 return contents_;
892 } 864 }
893 865
894 chromeos::ScreenObserver* WizardController::GetObserver(WizardScreen* screen) { 866 chromeos::ScreenObserver* WizardController::GetObserver(WizardScreen* screen) {
895 return observer_ ? observer_ : this; 867 return observer_ ? observer_ : this;
896 } 868 }
897 869
898 void WizardController::SetZeroDelays() { 870 void WizardController::SetZeroDelays() {
899 kShowDelayMs = 0; 871 kShowDelayMs = 0;
900 } 872 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/chromeos/mock_system_access.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698