#include "google_apis/common/auth_service.h"
#include <string>
#include <vector>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "base/scoped_observation.h"
#include "base/task/single_thread_task_runner.h"
#include "components/signin/public/identity_manager/access_token_fetcher.h"
#include "components/signin/public/identity_manager/access_token_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/signin/public/identity_manager/scope_set.h"
#include "google_apis/common/auth_service_observer.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace google_apis {
namespace {
class AuthRequest { … };
AuthRequest::AuthRequest(
signin::IdentityManager* identity_manager,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
AuthStatusCallback callback,
const std::vector<std::string>& scopes)
: … { … }
AuthRequest::~AuthRequest() { … }
void AuthRequest::OnAccessTokenFetchComplete(
GoogleServiceAuthError error,
signin::AccessTokenInfo token_info) { … }
}
class AuthService::IdentityManagerObserver
: public signin::IdentityManager::Observer { … };
AuthService::AuthService(
signin::IdentityManager* identity_manager,
const CoreAccountId& account_id,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const std::vector<std::string>& scopes)
: … { … }
AuthService::~AuthService() = default;
void AuthService::StartAuthentication(AuthStatusCallback callback) { … }
bool AuthService::HasAccessToken() const { … }
bool AuthService::HasRefreshToken() const { … }
const std::string& AuthService::access_token() const { … }
void AuthService::ClearAccessToken() { … }
void AuthService::ClearRefreshToken() { … }
void AuthService::OnAuthCompleted(AuthStatusCallback callback,
ApiErrorCode error,
const std::string& access_token) { … }
void AuthService::AddObserver(AuthServiceObserver* observer) { … }
void AuthService::RemoveObserver(AuthServiceObserver* observer) { … }
void AuthService::OnHandleRefreshToken(const CoreAccountId& account_id,
bool has_refresh_token) { … }
}