Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.cc

Issue 2320813002: arc: Enable silent PlayStore Sign-In. (Closed)
Patch Set: cleanup Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}
}

Powered by Google App Engine
This is Rietveld 408576698