Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <signal.h> | 7 #include <signal.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { | 202 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { |
| 203 OnLocalStateInitialized(false); | 203 OnLocalStateInitialized(false); |
| 204 return; | 204 return; |
| 205 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { | 205 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { |
| 206 GetLocalState()->AddPrefInitObserver( | 206 GetLocalState()->AddPrefInitObserver( |
| 207 base::Bind(&WizardController::OnLocalStateInitialized, | 207 base::Bind(&WizardController::OnLocalStateInitialized, |
| 208 weak_factory_.GetWeakPtr())); | 208 weak_factory_.GetWeakPtr())); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 AdvanceToScreen(first_screen_name); | 212 bool shoud_not_resume = false; |
|
Mattias Nissler (ping if slow)
2014/05/14 13:39:03
This could just be should_not_resume = <condition-
pastarmovj
2014/05/14 14:23:49
True. This code was going through a couple of vers
| |
| 213 if (is_out_of_box_ && !first_screen_name.empty() && | |
| 214 first_screen_name != WizardController::kTestNoScreenName) { | |
| 215 shoud_not_resume = true; | |
| 216 } | |
| 217 const PrefService::Preference* oobe_stage_pref = | |
| 218 GetLocalState()->FindPreference(prefs::kOobeStagePending); | |
|
Mattias Nissler (ping if slow)
2014/05/14 13:39:03
it's a bit confusing that the new code calls this
| |
| 219 if (!oobe_stage_pref->IsDefaultValue() && !shoud_not_resume) { | |
|
Mattias Nissler (ping if slow)
2014/05/14 13:39:03
Why would you need a default value check here?
Mattias Nissler (ping if slow)
2014/05/14 13:39:03
nit: no curlies required.
pastarmovj
2014/05/14 14:23:49
If there is no value set we don't need to interven
Mattias Nissler (ping if slow)
2014/05/14 14:54:41
Well, you could just check for empty string I gues
pastarmovj
2014/05/14 15:26:44
I think doing the check this way is more efficient
Mattias Nissler (ping if slow)
2014/05/15 09:30:25
I don't think efficiency matters at all here (it's
| |
| 220 first_screen_name_ = GetLocalState()->GetString(prefs::kOobeStagePending); | |
| 221 } | |
| 222 | |
| 223 AdvanceToScreen(first_screen_name_); | |
| 213 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && | 224 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && |
| 214 first_screen_name.empty()) | 225 first_screen_name_.empty()) |
| 215 ShowWrongHWIDScreen(); | 226 ShowWrongHWIDScreen(); |
| 216 } | 227 } |
| 217 | 228 |
| 218 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { | 229 chromeos::NetworkScreen* WizardController::GetNetworkScreen() { |
| 219 if (!network_screen_.get()) | 230 if (!network_screen_.get()) |
| 220 network_screen_.reset(new chromeos::NetworkScreen( | 231 network_screen_.reset(new chromeos::NetworkScreen( |
| 221 this, oobe_display_->GetNetworkScreenActor())); | 232 this, oobe_display_->GetNetworkScreenActor())); |
| 222 return network_screen_.get(); | 233 return network_screen_.get(); |
| 223 } | 234 } |
| 224 | 235 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 754 } else { | 765 } else { |
| 755 ShowCurrentScreen(); | 766 ShowCurrentScreen(); |
| 756 } | 767 } |
| 757 } | 768 } |
| 758 | 769 |
| 759 void WizardController::SetStatusAreaVisible(bool visible) { | 770 void WizardController::SetStatusAreaVisible(bool visible) { |
| 760 host_->SetStatusAreaVisible(visible); | 771 host_->SetStatusAreaVisible(visible); |
| 761 } | 772 } |
| 762 | 773 |
| 763 void WizardController::AdvanceToScreen(const std::string& screen_name) { | 774 void WizardController::AdvanceToScreen(const std::string& screen_name) { |
| 775 // First remember how far have we reached so that we can resume if needed. | |
|
Mattias Nissler (ping if slow)
2014/05/14 13:39:03
Most transitions go through SetCurrentScreen inste
pastarmovj
2014/05/14 14:23:49
Yep missed that one but now it is added and I veri
| |
| 776 if (is_out_of_box_) | |
| 777 StartupUtils::SaveOobePendingStage(screen_name); | |
| 778 | |
| 764 if (screen_name == kNetworkScreenName) { | 779 if (screen_name == kNetworkScreenName) { |
| 765 ShowNetworkScreen(); | 780 ShowNetworkScreen(); |
| 766 } else if (screen_name == kLoginScreenName) { | 781 } else if (screen_name == kLoginScreenName) { |
| 767 ShowLoginScreen(LoginScreenContext()); | 782 ShowLoginScreen(LoginScreenContext()); |
| 768 } else if (screen_name == kUpdateScreenName) { | 783 } else if (screen_name == kUpdateScreenName) { |
| 769 InitiateOOBEUpdate(); | 784 InitiateOOBEUpdate(); |
| 770 } else if (screen_name == kUserImageScreenName) { | 785 } else if (screen_name == kUserImageScreenName) { |
| 771 ShowUserImageScreen(); | 786 ShowUserImageScreen(); |
| 772 } else if (screen_name == kEulaScreenName) { | 787 } else if (screen_name == kEulaScreenName) { |
| 773 ShowEulaScreen(); | 788 ShowEulaScreen(); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1060 // cancelled on destruction. | 1075 // cancelled on destruction. |
| 1061 GetTimezoneProvider()->RequestTimezone( | 1076 GetTimezoneProvider()->RequestTimezone( |
| 1062 position, | 1077 position, |
| 1063 false, // sensor | 1078 false, // sensor |
| 1064 timeout - elapsed, | 1079 timeout - elapsed, |
| 1065 base::Bind(&WizardController::OnTimezoneResolved, | 1080 base::Bind(&WizardController::OnTimezoneResolved, |
| 1066 base::Unretained(this))); | 1081 base::Unretained(this))); |
| 1067 } | 1082 } |
| 1068 | 1083 |
| 1069 } // namespace chromeos | 1084 } // namespace chromeos |
| OLD | NEW |