#include "components/drive/drive_notification_manager.h"
#include <string_view>
#include <utility>
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/observer_list.h"
#include "base/rand_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "components/drive/drive_notification_observer.h"
#include "components/invalidation/public/invalidation.h"
#include "components/invalidation/public/invalidation_service.h"
#include "components/invalidation/public/invalidator_state.h"
namespace drive {
namespace {
const int kFastPollingIntervalInSecs = …;
const int kSlowPollingIntervalInSecs = …;
constexpr int kInvalidationBatchIntervalSecs = …;
const char kDriveInvalidationTopicName[] = …;
constexpr char kTeamDriveChangePrefix[] = …;
}
DriveNotificationManager::DriveNotificationManager(
invalidation::InvalidationService* invalidation_service,
const base::TickClock* clock)
: … { … }
DriveNotificationManager::~DriveNotificationManager() { … }
void DriveNotificationManager::Shutdown() { … }
void DriveNotificationManager::OnInvalidatorStateChange(
invalidation::InvalidatorState state) { … }
void DriveNotificationManager::OnIncomingInvalidation(
const invalidation::Invalidation& invalidation) { … }
std::string DriveNotificationManager::GetOwnerName() const { … }
bool DriveNotificationManager::IsPublicTopic(
const invalidation::Topic& topic) const { … }
void DriveNotificationManager::AddObserver(
DriveNotificationObserver* observer) { … }
void DriveNotificationManager::RemoveObserver(
DriveNotificationObserver* observer) { … }
void DriveNotificationManager::UpdateTeamDriveIds(
const std::set<std::string>& added_team_drive_ids,
const std::set<std::string>& removed_team_drive_ids) { … }
void DriveNotificationManager::ClearTeamDriveIds() { … }
bool DriveNotificationManager::IsRegistered() const { … }
bool DriveNotificationManager::AreInvalidationsEnabled() const { … }
void DriveNotificationManager::RestartPollingTimer() { … }
void DriveNotificationManager::RestartBatchTimer() { … }
void DriveNotificationManager::NotifyObserversToUpdate(
NotificationSource source,
std::map<std::string, int64_t> invalidations) { … }
void DriveNotificationManager::RegisterDriveNotifications() { … }
void DriveNotificationManager::UpdateRegisteredDriveNotifications() { … }
void DriveNotificationManager::OnBatchTimerExpired() { … }
std::string DriveNotificationManager::NotificationSourceToString(
NotificationSource source) { … }
invalidation::Topic DriveNotificationManager::GetDriveInvalidationTopic()
const { … }
invalidation::Topic DriveNotificationManager::GetTeamDriveInvalidationTopic(
const std::string& team_drive_id) const { … }
std::string DriveNotificationManager::ExtractTeamDriveId(
std::string_view topic_name) const { … }
}