#include "components/policy/core/common/cloud/cloud_policy_client_registration_helper.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/policy/core/common/cloud/client_data_delegate.h"
#include "components/policy/core/common/cloud/dm_auth.h"
#include "components/policy/core/common/policy_logger.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/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace policy {
const char kGetHostedDomainKey[] = …;
StringCallback;
class CloudPolicyClientRegistrationHelper::IdentityManagerHelper { … };
void CloudPolicyClientRegistrationHelper::IdentityManagerHelper::
FetchAccessToken(signin::IdentityManager* identity_manager,
const CoreAccountId& account_id,
StringCallback callback) { … }
void CloudPolicyClientRegistrationHelper::IdentityManagerHelper::
OnAccessTokenFetchComplete(GoogleServiceAuthError error,
signin::AccessTokenInfo token_info) { … }
CloudPolicyClientRegistrationHelper::CloudPolicyClientRegistrationHelper(
CloudPolicyClient* client,
enterprise_management::DeviceRegisterRequest::Type registration_type)
: … { … }
CloudPolicyClientRegistrationHelper::~CloudPolicyClientRegistrationHelper() { … }
void CloudPolicyClientRegistrationHelper::StartRegistration(
signin::IdentityManager* identity_manager,
const CoreAccountId& account_id,
base::OnceClosure callback) { … }
void CloudPolicyClientRegistrationHelper::StartRegistrationWithEnrollmentToken(
const std::string& token,
const std::string& client_id,
const ClientDataDelegate& client_data_delegate,
bool is_mandatory,
base::OnceClosure callback) { … }
void CloudPolicyClientRegistrationHelper::StartRegistrationWithOidcTokens(
const std::string& oauth_token,
const std::string& id_token,
const std::string& client_id,
const std::string& state,
const base::TimeDelta& timeout_duration,
base::OnceClosure callback) { … }
void CloudPolicyClientRegistrationHelper::OnTokenFetched(
const std::string& access_token) { … }
void CloudPolicyClientRegistrationHelper::OnGetUserInfoFailure(
const GoogleServiceAuthError& error) { … }
void CloudPolicyClientRegistrationHelper::OnGetUserInfoSuccess(
const base::Value::Dict& data) { … }
void CloudPolicyClientRegistrationHelper::OnPolicyFetched(
CloudPolicyClient* client) { … }
void CloudPolicyClientRegistrationHelper::OnRegistrationStateChanged(
CloudPolicyClient* client) { … }
void CloudPolicyClientRegistrationHelper::OnClientError(
CloudPolicyClient* client) { … }
void CloudPolicyClientRegistrationHelper::RequestCompleted() { … }
}