#include "components/invalidation/invalidation_listener_impl.h"
#include "base/containers/map_util.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "components/gcm_driver/gcm_driver.h"
#include "components/gcm_driver/instance_id/instance_id.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/invalidation/invalidation_listener.h"
#include "components/invalidation/public/invalidation.h"
#include "components/invalidation/public/invalidation_util.h"
namespace invalidation {
namespace {
const char kTypeKey[] = …;
const char kPayloadKey[] = …;
const char kIssueTimestampMsKey[] = …;
constexpr char RegistrationMetricName[] = …;
static constexpr net::BackoffEntry::Policy kRegistrationRetryBackoffPolicy = …;
std::string GetValueFromMessage(const gcm::IncomingMessage& message,
const std::string& key) { … }
DirectInvalidation ParseIncomingMessage(const gcm::IncomingMessage& message) { … }
void Upsert(std::map<Topic, DirectInvalidation>& map,
const DirectInvalidation& invalidation) { … }
}
InvalidationListenerImpl::InvalidationListenerImpl(
gcm::GCMDriver* gcm_driver,
instance_id::InstanceIDDriver* instance_id_driver,
std::string project_number,
std::string log_prefix)
: … { … }
InvalidationListenerImpl::~InvalidationListenerImpl() { … }
void InvalidationListenerImpl::AddObserver(Observer* observer) { … }
bool InvalidationListenerImpl::HasObserver(const Observer* observer) const { … }
void InvalidationListenerImpl::RemoveObserver(const Observer* observer) { … }
void InvalidationListenerImpl::Start(
RegistrationTokenHandler* registration_token_handler) { … }
void InvalidationListenerImpl::Shutdown() { … }
void InvalidationListenerImpl::SetRegistrationUploadStatus(
RegistrationTokenUploadStatus status) { … }
void InvalidationListenerImpl::ShutdownHandler() { … }
void InvalidationListenerImpl::OnStoreReset() { … }
void InvalidationListenerImpl::OnMessage(const std::string& app_id,
const gcm::IncomingMessage& message) { … }
void InvalidationListenerImpl::OnMessagesDeleted(const std::string& app_id) { … }
void InvalidationListenerImpl::OnSendError(
const std::string& app_id,
const gcm::GCMClient::SendErrorDetails& details) { … }
void InvalidationListenerImpl::OnSendAcknowledged(
const std::string& app_id,
const std::string& message_id) { … }
void InvalidationListenerImpl::FetchRegistrationToken() { … }
void InvalidationListenerImpl::OnRegistrationTokenReceived(
const std::string& new_registration_token,
instance_id::InstanceID::Result result) { … }
InvalidationsExpected InvalidationListenerImpl::AreInvalidationsExpected()
const { … }
void InvalidationListenerImpl::UpdateObserversExpectations() { … }
}