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

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

Issue 2320813002: arc: Enable silent PlayStore Sign-In. (Closed)
Patch Set: rebase/refactor 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_context.cc
diff --git a/chrome/browser/chromeos/arc/arc_auth_context.cc b/chrome/browser/chromeos/arc/arc_auth_context.cc
index a7d7747fde8a9a083dd71b317979e411e68b02d5..ffbd671313cd6fc38d95ebc4faa106199046add1 100644
--- a/chrome/browser/chromeos/arc/arc_auth_context.cc
+++ b/chrome/browser/chromeos/arc/arc_auth_context.cc
@@ -69,16 +69,19 @@ void ArcAuthContext::OnRefreshTokenTimeout() {
void ArcAuthContext::OnMergeSessionSuccess(const std::string& data) {
context_prepared_ = true;
+ ResetFetchers();
delegate_->OnContextReady();
}
void ArcAuthContext::OnMergeSessionFailure(
const GoogleServiceAuthError& error) {
VLOG(2) << "Failed to merge gaia session " << error.ToString() << ".";
+ ResetFetchers();
delegate_->OnPrepareContextFailed();
}
void ArcAuthContext::OnUbertokenSuccess(const std::string& token) {
+ ResetFetchers();
merger_fetcher_.reset(
new GaiaAuthFetcher(this, GaiaConstants::kChromeOSSource,
storage_partition_->GetURLRequestContext()));
@@ -87,6 +90,7 @@ void ArcAuthContext::OnUbertokenSuccess(const std::string& token) {
void ArcAuthContext::OnUbertokenFailure(const GoogleServiceAuthError& error) {
VLOG(2) << "Failed to get ubertoken " << error.ToString() << ".";
+ ResetFetchers();
delegate_->OnPrepareContextFailed();
}
@@ -112,11 +116,21 @@ void ArcAuthContext::PrepareContext() {
void ArcAuthContext::StartFetchers() {
DCHECK(!refresh_token_timeout_.IsRunning());
- merger_fetcher_.reset();
+ ResetFetchers();
ubertoken_fetcher_.reset(
new UbertokenFetcher(token_service_, this, GaiaConstants::kChromeOSSource,
storage_partition_->GetURLRequestContext()));
ubertoken_fetcher_->StartFetchingToken(account_id_);
}
+void ArcAuthContext::ResetFetchers() {
+ merger_fetcher_.reset();
+ ubertoken_fetcher_.reset();
+}
+
+net::URLRequestContextGetter* ArcAuthContext::GetURLRequestContext() {
+ DCHECK(context_prepared_);
+ return storage_partition_->GetURLRequestContext();
+}
+
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698