#include "remoting/base/oauth_token_getter_impl.h"
#include <memory>
#include <utility>
#include "base/containers/queue.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/string_util.h"
#include "google_apis/google_api_keys.h"
#include "remoting/base/logging.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace remoting {
namespace {
const int kMaxRetries = …;
const int kTokenUpdateTimeBeforeExpirySeconds = …;
constexpr base::TimeDelta kResponseTimeoutDuration = …;
}
OAuthTokenGetterImpl::OAuthTokenGetterImpl(
std::unique_ptr<OAuthIntermediateCredentials> intermediate_credentials,
const OAuthTokenGetter::CredentialsUpdatedCallback& on_credentials_update,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool auto_refresh)
: … { … }
OAuthTokenGetterImpl::OAuthTokenGetterImpl(
std::unique_ptr<OAuthAuthorizationCredentials> authorization_credentials,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool auto_refresh)
: … { … }
OAuthTokenGetterImpl::~OAuthTokenGetterImpl() { … }
void OAuthTokenGetterImpl::OnGetTokensResponse(const std::string& refresh_token,
const std::string& access_token,
int expires_seconds) { … }
void OAuthTokenGetterImpl::OnRefreshTokenResponse(
const std::string& access_token,
int expires_seconds) { … }
void OAuthTokenGetterImpl::OnGetUserEmailResponse(
const std::string& user_email) { … }
void OAuthTokenGetterImpl::UpdateAccessToken(const std::string& access_token,
int expires_seconds) { … }
void OAuthTokenGetterImpl::NotifyTokenCallbacks(
Status status,
const std::string& user_email,
const std::string& access_token) { … }
void OAuthTokenGetterImpl::NotifyUpdatedCallbacks(
const std::string& user_email,
const std::string& refresh_token) { … }
void OAuthTokenGetterImpl::OnOAuthError() { … }
void OAuthTokenGetterImpl::OnNetworkError(int response_code) { … }
void OAuthTokenGetterImpl::CallWithToken(TokenCallback on_access_token) { … }
void OAuthTokenGetterImpl::InvalidateCache() { … }
base::WeakPtr<OAuthTokenGetterImpl> OAuthTokenGetterImpl::GetWeakPtr() { … }
void OAuthTokenGetterImpl::GetOauthTokensFromAuthCode() { … }
void OAuthTokenGetterImpl::RefreshAccessToken() { … }
bool OAuthTokenGetterImpl::IsResponsePending() const { … }
void OAuthTokenGetterImpl::SetResponsePending(bool is_pending) { … }
void OAuthTokenGetterImpl::OnResponseTimeout() { … }
}