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 8a38c01ca6be1597837ae7a97d2a0ade72f898c8..049277ad2b687f3212f212a38175a6b3220511c2 100644 |
| --- a/chrome/browser/chromeos/arc/arc_session_manager.cc |
| +++ b/chrome/browser/chromeos/arc/arc_session_manager.cc |
| @@ -211,6 +211,7 @@ void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| return; |
| } |
| provisioning_reported_ = true; |
| + optin_flow_error_detected_ |= (result != ProvisioningResult::SUCCESS); |
| if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { |
| if (IsArcKioskMode()) { |
| @@ -240,6 +241,8 @@ void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| if (support_host_) |
| support_host_->Close(); |
| + StopOptInFlowTracking(true); |
| + |
| if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) |
| return; |
| @@ -548,6 +551,7 @@ void ArcSessionManager::RequestDisable() { |
| return; |
| } |
| enable_requested_ = false; |
| + StopOptInFlowTracking(false); |
| // Reset any pending request to re-enable ARC. |
| reenable_arc_ = false; |
| @@ -602,6 +606,7 @@ void ArcSessionManager::MaybeStartTermsOfServiceNegotiation() { |
| support_host_->ShowError( |
| ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR, false); |
| } |
| + UpdateOptInCancelUMA(OptInCancelReason::SESSION_BUSY); |
|
khmel
2017/03/29 21:41:09
We never recorded this issue. It would be nice to
|
| return; |
| } |
| @@ -609,6 +614,8 @@ void ArcSessionManager::MaybeStartTermsOfServiceNegotiation() { |
| // is fixed. |
| SetState(State::NEGOTIATING_TERMS_OF_SERVICE); |
| + StartOptInFlowTracking(); |
| + |
| if (!IsArcTermsOfServiceNegotiationNeeded()) { |
| // Moves to next state, Android management check, immediately, as if |
| // Terms of Service negotiation is done successfully. |
| @@ -956,6 +963,35 @@ void ArcSessionManager::SetAttemptUserExitCallbackForTesting( |
| attempt_user_exit_callback_ = callback; |
| } |
| +void ArcSessionManager::StartOptInFlowTracking() { |
| + // Test if we already started OptIn flow tracking. |
| + if (optin_flow_tracked_) |
| + return; |
| + |
| + if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn)) { |
| + VLOG(1) << "Skip tracking opt-in flow for already signed ARC"; |
| + return; |
| + } |
| + |
| + UpdateOptInFlowResultUMA(OptInFlowResult::STARTED); |
| + optin_flow_tracked_ = true; |
| + optin_flow_error_detected_ = false; |
| +} |
| + |
| +void ArcSessionManager::StopOptInFlowTracking(bool succeeded) { |
| + if (!optin_flow_tracked_) |
| + return; |
| + |
| + UpdateOptInFlowResultUMA(succeeded ? OptInFlowResult::SUCCEEDED |
| + : OptInFlowResult::CANCELED); |
| + if (optin_flow_error_detected_) { |
| + UpdateOptInFlowResultUMA(succeeded ? OptInFlowResult::SUCCEEDED_AFTER_RETRY |
| + : OptInFlowResult::CANCELED_AFTER_ERROR); |
| + } |
| + |
| + optin_flow_tracked_ = false; |
| +} |
| + |
| std::ostream& operator<<(std::ostream& os, |
| const ArcSessionManager::State& state) { |
| #define MAP_STATE(name) \ |