Chromium Code Reviews| Index: chrome/browser/chromeos/login/wizard_controller.cc | 
| diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc | 
| index 76a3644f3a98492a1e6bbf4443ef176d43db7d0d..a7028733aa308f5c28403e6bd452bbab95e7a8d7 100644 | 
| --- a/chrome/browser/chromeos/login/wizard_controller.cc | 
| +++ b/chrome/browser/chromeos/login/wizard_controller.cc | 
| @@ -255,6 +255,7 @@ WizardController::WizardController(LoginDisplayHost* host, OobeUI* oobe_ui) | 
| DCHECK(default_controller_ == nullptr); | 
| default_controller_ = this; | 
| screen_manager_ = base::MakeUnique<ScreenManager>(this); | 
| + device_marked_registered_ = StartupUtils::IsDeviceRegistered(); | 
| 
 
xiyuan
2017/06/12 17:19:56
|device_marked_registered_| does not look like rel
 
yueli
2017/06/12 20:10:07
How about use IsSessionStarted instead and add com
 
 | 
| if (!ash_util::IsRunningInMash()) { | 
| AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); | 
| CHECK(accessibility_manager); | 
| @@ -828,6 +829,13 @@ void WizardController::OnTermsOfServiceAccepted() { | 
| } | 
| void WizardController::OnArcTermsOfServiceFinished() { | 
| + const Profile* profile = ProfileManager::GetActiveUserProfile(); | 
| + if (device_marked_registered_) { | 
| + if (profile->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) | 
| + StartVoiceInteractionSetupWizard(); | 
| + OnOobeFlowFinished(); | 
| + return; | 
| + } | 
| // If the user finished with the PlayStore Terms of Service, advance to the | 
| // user image screen. | 
| ShowUserImageScreen(); | 
| @@ -838,12 +846,13 @@ void WizardController::OnVoiceInteractionValuePropSkipped() { | 
| } | 
| void WizardController::OnVoiceInteractionValuePropAccepted() { | 
| - // Start voice interaction setup wizard in container | 
| - arc::ArcVoiceInteractionFrameworkService* service = | 
| - arc::ArcServiceManager::Get() | 
| - ->GetService<arc::ArcVoiceInteractionFrameworkService>(); | 
| - if (service) | 
| - service->StartVoiceInteractionSetupWizard(); | 
| + const Profile* profile = ProfileManager::GetActiveUserProfile(); | 
| + if (device_marked_registered_ && | 
| + !arc::IsArcPlayStoreEnabledForProfile(profile)) { | 
| + ShowArcTermsOfServiceScreen(); | 
| + return; | 
| + } | 
| + StartVoiceInteractionSetupWizard(); | 
| OnOobeFlowFinished(); | 
| } | 
| @@ -862,6 +871,14 @@ void WizardController::OnAutoEnrollmentCheckCompleted() { | 
| } | 
| void WizardController::OnOobeFlowFinished() { | 
| + if (device_marked_registered_) { | 
| + host_->SetStatusAreaVisible(true); | 
| + base::OnceClosure empty_callback = base::BindOnce([] {}); | 
| + host_->Finalize(std::move(empty_callback)); | 
| 
 
xiyuan
2017/06/12 17:19:56
Since you don't care about the callback, you can j
 
yueli
2017/06/12 20:10:07
Done.
 
 | 
| + host_ = nullptr; | 
| + return; | 
| + } | 
| + | 
| if (!time_oobe_started_.is_null()) { | 
| base::TimeDelta delta = base::Time::Now() - time_oobe_started_; | 
| UMA_HISTOGRAM_CUSTOM_TIMES("OOBE.BootToSignInCompleted", delta, | 
| @@ -1544,7 +1561,8 @@ bool WizardController::ShouldShowArcTerms() const { | 
| } | 
| bool WizardController::ShouldShowVoiceInteractionValueProp() const { | 
| - if (!arc::IsArcPlayStoreEnabledForProfile( | 
| + if (!device_marked_registered_ && | 
| 
 
xc
2017/06/09 18:00:14
Add comment on why we need to do these check this
 
yueli
2017/06/12 20:10:07
Done.
 
 | 
| + !arc::IsArcPlayStoreEnabledForProfile( | 
| ProfileManager::GetActiveUserProfile())) { | 
| VLOG(1) << "Skip Voice Interaction Value Prop screen because Arc Terms is " | 
| << "skipped."; | 
| @@ -1558,6 +1576,14 @@ bool WizardController::ShouldShowVoiceInteractionValueProp() const { | 
| return true; | 
| } | 
| +void WizardController::StartVoiceInteractionSetupWizard() { | 
| + arc::ArcVoiceInteractionFrameworkService* service = | 
| + arc::ArcServiceManager::Get() | 
| + ->GetService<arc::ArcVoiceInteractionFrameworkService>(); | 
| + if (service) | 
| + service->StartVoiceInteractionSetupWizard(); | 
| +} | 
| + | 
| void WizardController::MaybeStartListeningForSharkConnection() { | 
| // We shouldn't be here if we are running pairing OOBE already. | 
| if (IsControllerDetected()) |