Index: chrome/browser/chromeos/arc/arc_auth_service.cc |
diff --git a/chrome/browser/chromeos/arc/arc_auth_service.cc b/chrome/browser/chromeos/arc/arc_auth_service.cc |
index 20c6bde299bf4c483288f613ec66195fb6ab04f6..d4e2a5618cde71c3e635700608710ec3a6d1be56 100644 |
--- a/chrome/browser/chromeos/arc/arc_auth_service.cc |
+++ b/chrome/browser/chromeos/arc/arc_auth_service.cc |
@@ -791,6 +791,19 @@ void ArcAuthService::OnPrepareContextFailed() { |
UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); |
} |
+void ArcAuthService::OnAuthCodeRequested(const std::string& auth_code) { |
+ SetAuthCodeAndStartArc(auth_code); |
+} |
+ |
+void ArcAuthService::OnAuthCodeFailed() { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
+ DCHECK_EQ(state_, State::FETCHING_CODE); |
+ ShutdownBridgeAndShowUI( |
+ UIPage::ERROR, |
+ l10n_util::GetStringUTF16(IDS_ARC_SERVER_COMMUNICATION_ERROR)); |
+ UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); |
+} |
+ |
void ArcAuthService::CheckAndroidManagement(bool background_mode) { |
// Do not send requests for Chrome OS managed users. |
if (IsAccountManaged(profile_)) { |
@@ -840,13 +853,26 @@ void ArcAuthService::OnAndroidManagementChecked( |
} |
void ArcAuthService::StartArcIfSignedIn() { |
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
if (state_ == State::ACTIVE) |
return; |
+ |
if (profile_->GetPrefs()->GetBoolean(prefs::kArcSignedIn) || |
IsOptInVerificationDisabled()) { |
StartArc(); |
} else { |
- ShowUI(UIPage::LSO_PROGRESS, base::string16()); |
+ const base::CommandLine* command_line = |
+ base::CommandLine::ForCurrentProcess(); |
+ std::string auth_endpoint; |
+ if (command_line->HasSwitch(chromeos::switches::kArcUseAuthEndpoint)) { |
+ auth_endpoint = command_line->GetSwitchValueASCII( |
+ chromeos::switches::kArcUseAuthEndpoint); |
+ } |
+ |
+ if (!auth_endpoint.empty()) |
+ context_->FetchAuthCode(auth_endpoint); |
+ else |
+ ShowUI(UIPage::LSO_PROGRESS, base::string16()); |
} |
} |