#include "chrome/browser/extensions/api/gcm/gcm_api.h"
#include <stddef.h>
#include <algorithm>
#include <map>
#include <memory>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/gcm/gcm_profile_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/gcm.h"
#include "components/gcm_driver/common/gcm_message.h"
#include "components/gcm_driver/gcm_driver.h"
#include "components/gcm_driver/gcm_profile_service.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/extension.h"
namespace {
const size_t kMaximumGcmMessageSize = …;
const char kCollapseKey[] = …;
const char kGoogDotRestrictedPrefix[] = …;
const char kGoogleRestrictedPrefix[] = …;
const char kInvalidParameter[] = …;
const char kGCMDisabled[] = …;
const char kAsyncOperationPending[] = …;
const char kNetworkError[] = …;
const char kServerError[] = …;
const char kTtlExceeded[] = …;
const char kUnknownError[] = …;
const char* GcmResultToError(gcm::GCMClient::Result result) { … }
bool IsMessageKeyValid(const std::string& key) { … }
}
namespace extensions {
bool GcmApiFunction::PreRunValidation(std::string* error) { … }
bool GcmApiFunction::IsGcmApiEnabled(std::string* error) const { … }
gcm::GCMDriver* GcmApiFunction::GetGCMDriver() const { … }
GcmRegisterFunction::GcmRegisterFunction() { … }
GcmRegisterFunction::~GcmRegisterFunction() { … }
ExtensionFunction::ResponseAction GcmRegisterFunction::Run() { … }
void GcmRegisterFunction::CompleteFunctionWithResult(
const std::string& registration_id,
gcm::GCMClient::Result gcm_result) { … }
GcmUnregisterFunction::GcmUnregisterFunction() { … }
GcmUnregisterFunction::~GcmUnregisterFunction() { … }
ExtensionFunction::ResponseAction GcmUnregisterFunction::Run() { … }
void GcmUnregisterFunction::CompleteFunctionWithResult(
gcm::GCMClient::Result result) { … }
GcmSendFunction::GcmSendFunction() { … }
GcmSendFunction::~GcmSendFunction() { … }
ExtensionFunction::ResponseAction GcmSendFunction::Run() { … }
void GcmSendFunction::CompleteFunctionWithResult(
const std::string& message_id,
gcm::GCMClient::Result gcm_result) { … }
bool GcmSendFunction::ValidateMessageData(const gcm::MessageData& data) const { … }
GcmJsEventRouter::GcmJsEventRouter(Profile* profile) : … { … }
GcmJsEventRouter::~GcmJsEventRouter() { … }
void GcmJsEventRouter::OnMessage(const std::string& app_id,
const gcm::IncomingMessage& message) { … }
void GcmJsEventRouter::OnMessagesDeleted(const std::string& app_id) { … }
void GcmJsEventRouter::OnSendError(
const std::string& app_id,
const gcm::GCMClient::SendErrorDetails& send_error_details) { … }
}