Chromium Code Reviews| Index: chrome/browser/chromeos/arc/arc_session_manager.cc |
| diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc |
| index 21effca88e1741d7f087ae3c547c954e774f4945..26f2eeb0e59306a92fdd0db61e6a9783fe5e8a72 100644 |
| --- a/chrome/browser/chromeos/arc/arc_session_manager.cc |
| +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc |
| @@ -110,6 +110,7 @@ void ArcSessionManager::RegisterProfilePrefs( |
| user_prefs::PrefRegistrySyncable* registry) { |
| // TODO(dspaid): Implement a mechanism to allow this to sync on first boot |
| // only. |
| + registry->RegisterBooleanPref(prefs::kArcDataInvalid, false); |
| registry->RegisterBooleanPref(prefs::kArcEnabled, false); |
| registry->RegisterBooleanPref(prefs::kArcSignedIn, false); |
| registry->RegisterBooleanPref(prefs::kArcTermsAccepted, false); |
| @@ -188,7 +189,7 @@ void ArcSessionManager::OnBridgeStopped(ArcBridgeService::StopReason reason) { |
| OnProvisioningFinished(ProvisioningResult::ARC_STOPPED); |
| } |
| - if (clear_required_) { |
| + if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataInvalid)) { |
| // This should be always true, but just in case as this is looked at |
| // inside RemoveArcData() at first. |
| DCHECK(arc_bridge_service()->stopped()); |
| @@ -205,13 +206,15 @@ void ArcSessionManager::OnBridgeStopped(ArcBridgeService::StopReason reason) { |
| } |
| void ArcSessionManager::RemoveArcData() { |
| + // OnArcDataRemoved resets this flag. |
|
Luis Héctor Chávez
2016/11/30 23:30:14
Ah, I like this better :)
khmel
2016/11/30 23:50:34
Acknowledged.
|
| + profile_->GetPrefs()->SetBoolean(prefs::kArcDataInvalid, true); |
| + |
| if (!arc_bridge_service()->stopped()) { |
| // Just set a flag. On bridge stopped, this will be re-called, |
| // then session manager should remove the data. |
| - clear_required_ = true; |
| return; |
| } |
| - clear_required_ = false; |
| + |
| chromeos::DBusThreadManager::Get()->GetSessionManagerClient()->RemoveArcData( |
| cryptohome::Identification( |
| multi_user_util::GetAccountIdFromProfile(profile_)), |
| @@ -222,6 +225,8 @@ void ArcSessionManager::RemoveArcData() { |
| void ArcSessionManager::OnArcDataRemoved(bool success) { |
| LOG_IF(ERROR, !success) << "Required ARC user data wipe failed."; |
| + profile_->GetPrefs()->SetBoolean(prefs::kArcDataInvalid, false); |
| + |
| // Here check if |reenable_arc_| is marked or not. |
| // The only case this happens should be in the special case for enterprise |
| // "on managed lost" case. In that case, OnBridgeStopped() should trigger |
| @@ -261,6 +266,9 @@ void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| if (support_host_) |
| support_host_->Close(); |
| + // Make sure request to clean data folder is off. |
|
Luis Héctor Chávez
2016/11/30 23:30:14
nit: s/clean/remove/
khmel
2016/11/30 23:50:34
Done.
|
| + profile_->GetPrefs()->SetBoolean(prefs::kArcDataInvalid, false); |
| + |
| if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) |
| return; |
| @@ -565,6 +573,15 @@ void ArcSessionManager::StopAndEnableArc() { |
| void ArcSessionManager::StartArc() { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| + |
| + // Don't start Arc until data is marked as invalid. Restart Arc once data is |
|
Luis Héctor Chávez
2016/11/30 23:30:14
nit: Don't start ARC if there is a pending request
khmel
2016/11/30 23:50:34
Done.
|
| + // clearned. |
| + if (profile_->GetPrefs()->GetBoolean(prefs::kArcDataInvalid)) { |
| + reenable_arc_ = true; |
| + RemoveArcData(); |
| + return; |
| + } |
| + |
| arc_bridge_service()->RequestStart(); |
| SetState(State::ACTIVE); |
| } |