| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/arc/arc_auth_context.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_context.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 10 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void ArcAuthContext::OnRefreshTokenTimeout() { | 88 void ArcAuthContext::OnRefreshTokenTimeout() { |
| 89 LOG(WARNING) << "Failed to wait for refresh token."; | 89 LOG(WARNING) << "Failed to wait for refresh token."; |
| 90 token_service_->RemoveObserver(this); | 90 token_service_->RemoveObserver(this); |
| 91 base::ResetAndReturn(&callback_).Run(nullptr); | 91 base::ResetAndReturn(&callback_).Run(nullptr); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void ArcAuthContext::StartFetchers() { | 94 void ArcAuthContext::StartFetchers() { |
| 95 DCHECK(!refresh_token_timeout_.IsRunning()); | 95 DCHECK(!refresh_token_timeout_.IsRunning()); |
| 96 ResetFetchers(); | 96 ResetFetchers(); |
| 97 |
| 98 if (skip_merge_session_for_testing_) { |
| 99 OnMergeSessionSuccess(""); |
| 100 return; |
| 101 } |
| 102 |
| 97 ubertoken_fetcher_.reset( | 103 ubertoken_fetcher_.reset( |
| 98 new UbertokenFetcher(token_service_, this, GaiaConstants::kChromeOSSource, | 104 new UbertokenFetcher(token_service_, this, GaiaConstants::kChromeOSSource, |
| 99 storage_partition_->GetURLRequestContext())); | 105 storage_partition_->GetURLRequestContext())); |
| 100 ubertoken_fetcher_->StartFetchingToken(account_id_); | 106 ubertoken_fetcher_->StartFetchingToken(account_id_); |
| 101 } | 107 } |
| 102 | 108 |
| 103 void ArcAuthContext::OnUbertokenSuccess(const std::string& token) { | 109 void ArcAuthContext::OnUbertokenSuccess(const std::string& token) { |
| 104 ResetFetchers(); | 110 ResetFetchers(); |
| 105 merger_fetcher_.reset( | 111 merger_fetcher_.reset( |
| 106 new GaiaAuthFetcher(this, GaiaConstants::kChromeOSSource, | 112 new GaiaAuthFetcher(this, GaiaConstants::kChromeOSSource, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 127 ResetFetchers(); | 133 ResetFetchers(); |
| 128 base::ResetAndReturn(&callback_).Run(nullptr); | 134 base::ResetAndReturn(&callback_).Run(nullptr); |
| 129 } | 135 } |
| 130 | 136 |
| 131 void ArcAuthContext::ResetFetchers() { | 137 void ArcAuthContext::ResetFetchers() { |
| 132 merger_fetcher_.reset(); | 138 merger_fetcher_.reset(); |
| 133 ubertoken_fetcher_.reset(); | 139 ubertoken_fetcher_.reset(); |
| 134 } | 140 } |
| 135 | 141 |
| 136 } // namespace arc | 142 } // namespace arc |
| OLD | NEW |