#include "components/commerce/core/account_checker.h"
#include "base/json/json_writer.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/commerce/core/commerce_constants.h"
#include "components/commerce/core/commerce_feature_list.h"
#include "components/commerce/core/pref_names.h"
#include "components/endpoint_fetcher/endpoint_fetcher.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/identity_manager/account_capabilities.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/sync/base/features.h"
#include "components/sync/service/sync_service_utils.h"
#include "components/sync/service/sync_user_settings.h"
#include "components/unified_consent/url_keyed_data_collection_consent_helper.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace {
constexpr base::TimeDelta kTimeout = …;
const char kPriceTrackEmailPref[] = …;
const char kPreferencesKey[] = …;
}
namespace commerce {
const char kNotificationsPrefUrl[] = …;
AccountChecker::AccountChecker(
std::string country,
std::string locale,
PrefService* pref_service,
signin::IdentityManager* identity_manager,
syncer::SyncService* sync_service,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
AccountChecker::~AccountChecker() = default;
bool AccountChecker::IsSignedIn() { … }
bool AccountChecker::IsSyncingBookmarks() { … }
bool AccountChecker::IsSyncTypeEnabled(syncer::UserSelectableType type) { … }
bool AccountChecker::IsAnonymizedUrlDataCollectionEnabled() { … }
bool AccountChecker::IsSubjectToParentalControls() { … }
bool AccountChecker::CanUseModelExecutionFeatures() { … }
std::string AccountChecker::GetCountry() { … }
std::string AccountChecker::GetLocale() { … }
PrefService* AccountChecker::GetPrefs() { … }
void AccountChecker::FetchPriceEmailPref() { … }
void AccountChecker::HandleFetchPriceEmailPrefResponse(
std::unique_ptr<EndpointFetcher> endpoint_fetcher,
std::unique_ptr<EndpointResponse> responses) { … }
void AccountChecker::OnFetchPriceEmailPrefJsonParsed(
data_decoder::DataDecoder::ValueOrError result) { … }
void AccountChecker::OnPriceEmailPrefChanged() { … }
void AccountChecker::HandleSendPriceEmailPrefResponse(
std::unique_ptr<EndpointFetcher> endpoint_fetcher,
std::unique_ptr<EndpointResponse> responses) { … }
void AccountChecker::OnSendPriceEmailPrefJsonParsed(
data_decoder::DataDecoder::ValueOrError result) { … }
std::unique_ptr<EndpointFetcher> AccountChecker::CreateEndpointFetcher(
const std::string& oauth_consumer_name,
const GURL& url,
const std::string& http_method,
const std::string& content_type,
const std::vector<std::string>& scopes,
const base::TimeDelta& timeout,
const std::string& post_data,
const net::NetworkTrafficAnnotationTag& annotation_tag) { … }
}