#include "components/gcm_driver/gcm_account_mapper.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/uuid.h"
#include "components/gcm_driver/gcm_driver_desktop.h"
#include "google_apis/gcm/engine/gcm_store.h"
namespace gcm {
namespace {
const char kGCMAccountMapperSenderId[] = …;
const char kGCMAccountMapperSendTo[] = …;
const int kGCMAddMappingMessageTTL = …;
const int kGCMRemoveMappingMessageTTL = …;
const int kGCMUpdateIntervalHours = …;
const int kGCMUpdateEarlyStartHours = …;
const char kRegistrationIdMessgaeKey[] = …;
const char kTokenMessageKey[] = …;
const char kAccountMessageKey[] = …;
const char kRemoveAccountKey[] = …;
const char kRemoveAccountValue[] = …;
const char kGCMSendToGaiaIdAppIdKey[] = …;
std::string GenerateMessageID() { … }
}
const char kGCMAccountMapperAppId[] = …;
GCMAccountMapper::GCMAccountMapper(GCMDriver* gcm_driver)
: … { … }
GCMAccountMapper::~GCMAccountMapper() = default;
void GCMAccountMapper::Initialize(const AccountMappings& account_mappings,
const DispatchMessageCallback& callback) { … }
void GCMAccountMapper::SetAccountTokens(
const std::vector<GCMClient::AccountTokenInfo>& account_tokens) { … }
void GCMAccountMapper::ShutdownHandler() { … }
void GCMAccountMapper::OnStoreReset() { … }
void GCMAccountMapper::OnMessage(const std::string& app_id,
const IncomingMessage& message) { … }
void GCMAccountMapper::OnMessagesDeleted(const std::string& app_id) { … }
void GCMAccountMapper::OnSendError(
const std::string& app_id,
const GCMClient::SendErrorDetails& send_error_details) { … }
void GCMAccountMapper::OnSendAcknowledged(const std::string& app_id,
const std::string& message_id) { … }
bool GCMAccountMapper::CanHandle(const std::string& app_id) const { … }
bool GCMAccountMapper::IsReady() { … }
void GCMAccountMapper::SendAddMappingMessage(AccountMapping& account_mapping) { … }
void GCMAccountMapper::SendRemoveMappingMessage(
AccountMapping& account_mapping) { … }
void GCMAccountMapper::CreateAndSendMessage(
const AccountMapping& account_mapping) { … }
void GCMAccountMapper::OnSendFinished(const CoreAccountId& account_id,
const std::string& message_id,
GCMClient::Result result) { … }
void GCMAccountMapper::GetRegistration() { … }
void GCMAccountMapper::OnRegisterFinished(const std::string& registration_id,
GCMClient::Result result) { … }
bool GCMAccountMapper::CanTriggerUpdate(
const base::Time& last_update_time) const { … }
bool GCMAccountMapper::IsLastStatusChangeOlderThanTTL(
const AccountMapping& account_mapping) const { … }
AccountMapping* GCMAccountMapper::FindMappingByAccountId(
const CoreAccountId& account_id) { … }
GCMAccountMapper::AccountMappings::iterator
GCMAccountMapper::FindMappingByMessageId(const std::string& message_id) { … }
void GCMAccountMapper::SetClockForTesting(base::Clock* clock) { … }
}