#include "chrome/browser/safe_browsing/cloud_content_scanning/binary_fcm_service.h"
#include <memory>
#include "base/base64.h"
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "chrome/browser/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/gcm/instance_id/instance_id_profile_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "components/enterprise/common/proto/connectors.pb.h"
#include "components/gcm_driver/gcm_driver.h"
#include "components/gcm_driver/gcm_profile_service.h"
#include "components/gcm_driver/instance_id/instance_id.h"
#include "components/gcm_driver/instance_id/instance_id_driver.h"
#include "components/gcm_driver/instance_id/instance_id_profile_service.h"
namespace safe_browsing {
namespace {
const char kBinaryFCMServiceAppId[] = …;
const char kBinaryFCMServiceSenderId[] = …;
const char kBinaryFCMServiceMessageKey[] = …;
}
const char BinaryFCMService::kInvalidId[] = …;
std::unique_ptr<BinaryFCMService> BinaryFCMService::Create(Profile* profile) { … }
BinaryFCMService::BinaryFCMService(
gcm::GCMDriver* gcm_driver,
instance_id::InstanceIDDriver* instance_id_driver)
: … { … }
BinaryFCMService::BinaryFCMService()
: … { … }
BinaryFCMService::~BinaryFCMService() { … }
void BinaryFCMService::GetInstanceID(GetInstanceIDCallback callback) { … }
void BinaryFCMService::QueueGetInstanceIDCallback(
GetInstanceIDCallback callback) { … }
void BinaryFCMService::SetCallbackForToken(const std::string& token,
OnMessageCallback callback) { … }
void BinaryFCMService::ClearCallbackForToken(const std::string& token) { … }
void BinaryFCMService::UnregisterInstanceID(
const std::string& instance_id,
UnregisterInstanceIDCallback callback) { … }
void BinaryFCMService::SetQueuedOperationDelayForTesting(
base::TimeDelta delay) { … }
void BinaryFCMService::OnGetInstanceID(GetInstanceIDCallback callback,
const std::string& instance_id,
instance_id::InstanceID::Result result) { … }
void BinaryFCMService::MaybeRunNextQueuedOperation() { … }
void BinaryFCMService::ShutdownHandler() { … }
void BinaryFCMService::OnStoreReset() { … }
void BinaryFCMService::OnMessage(const std::string& app_id,
const gcm::IncomingMessage& message) { … }
void BinaryFCMService::OnMessagesDeleted(const std::string& app_id) { … }
void BinaryFCMService::OnSendError(
const std::string& app_id,
const gcm::GCMClient::SendErrorDetails& send_error_details) { … }
void BinaryFCMService::OnSendAcknowledged(const std::string& app_id,
const std::string& message_id) { … }
bool BinaryFCMService::CanHandle(const std::string& app_id) const { … }
bool BinaryFCMService::Connected() { … }
void BinaryFCMService::UnregisterInstanceIDImpl(
const std::string& instance_id,
UnregisterInstanceIDCallback callback) { … }
void BinaryFCMService::OnInstanceIDUnregistered(
const std::string& token,
UnregisterInstanceIDCallback callback,
instance_id::InstanceID::Result result) { … }
void BinaryFCMService::Shutdown() { … }
}