#include "components/gcm_driver/gcm_driver.h"
#include <stddef.h>
#include <algorithm>
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "components/gcm_driver/crypto/gcm_decryption_result.h"
#include "components/gcm_driver/crypto/gcm_encryption_result.h"
#include "components/gcm_driver/gcm_app_handler.h"
namespace gcm {
namespace {
constexpr char kFcmInvalidationsApplicationName[] = …;
constexpr char kSyncInvalidationsApplicationName[] = …;
void LogDeliveredToAppHandler(const std::string& app_id, bool has_app_handler) { … }
}
InstanceIDHandler::InstanceIDHandler() = default;
InstanceIDHandler::~InstanceIDHandler() = default;
void InstanceIDHandler::DeleteAllTokensForApp(const std::string& app_id,
DeleteTokenCallback callback) { … }
GCMDriver::GCMDriver(
const base::FilePath& store_path,
const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { … }
GCMDriver::~GCMDriver() = default;
void GCMDriver::Register(const std::string& app_id,
const std::vector<std::string>& sender_ids,
RegisterCallback callback) { … }
void GCMDriver::Unregister(const std::string& app_id,
UnregisterCallback callback) { … }
void GCMDriver::UnregisterWithSenderId(const std::string& app_id,
const std::string& sender_id,
UnregisterCallback callback) { … }
void GCMDriver::UnregisterInternal(const std::string& app_id,
const std::string* sender_id,
UnregisterCallback callback) { … }
void GCMDriver::Send(const std::string& app_id,
const std::string& receiver_id,
const OutgoingMessage& message,
SendCallback callback) { … }
void GCMDriver::GetEncryptionInfo(const std::string& app_id,
GetEncryptionInfoCallback callback) { … }
void GCMDriver::UnregisterWithSenderIdImpl(const std::string& app_id,
const std::string& sender_id) { … }
void GCMDriver::RegisterFinished(const std::string& app_id,
const std::string& registration_id,
GCMClient::Result result) { … }
void GCMDriver::RemoveEncryptionInfoAfterUnregister(const std::string& app_id,
GCMClient::Result result) { … }
void GCMDriver::UnregisterFinished(const std::string& app_id,
GCMClient::Result result) { … }
void GCMDriver::SendFinished(const std::string& app_id,
const std::string& message_id,
GCMClient::Result result) { … }
void GCMDriver::Shutdown() { … }
void GCMDriver::AddAppHandler(const std::string& app_id,
GCMAppHandler* handler) { … }
void GCMDriver::RemoveAppHandler(const std::string& app_id) { … }
GCMAppHandler* GCMDriver::GetAppHandler(const std::string& app_id) { … }
GCMEncryptionProvider* GCMDriver::GetEncryptionProviderInternal() { … }
bool GCMDriver::HasRegisterCallback(const std::string& app_id) { … }
void GCMDriver::ClearCallbacks() { … }
void GCMDriver::DispatchMessage(const std::string& app_id,
const IncomingMessage& message) { … }
void GCMDriver::DispatchMessageInternal(const std::string& app_id,
GCMDecryptionResult result,
IncomingMessage message) { … }
void GCMDriver::RegisterAfterUnregister(
const std::string& app_id,
const std::vector<std::string>& normalized_sender_ids,
UnregisterCallback unregister_callback,
GCMClient::Result result) { … }
void GCMDriver::EncryptMessage(const std::string& app_id,
const std::string& authorized_entity,
const std::string& p256dh,
const std::string& auth_secret,
const std::string& message,
EncryptMessageCallback callback) { … }
void GCMDriver::OnMessageEncrypted(EncryptMessageCallback callback,
GCMEncryptionResult result,
std::string message) { … }
void GCMDriver::DecryptMessage(const std::string& app_id,
const std::string& authorized_entity,
const std::string& message,
DecryptMessageCallback callback) { … }
void GCMDriver::OnMessageDecrypted(DecryptMessageCallback callback,
GCMDecryptionResult result,
IncomingMessage message) { … }
}