chromium/remoting/base/chromoting_event.cc

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "remoting/base/chromoting_event.h"

#include "base/strings/string_util.h"
#include "base/strings/stringize_macros.h"
#include "base/system/sys_info.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "remoting/base/name_value_map.h"

namespace remoting {

namespace {

const NameMapElement<ChromotingEvent::AuthMethod> kAuthMethodNames[]{
    {ChromotingEvent::AuthMethod::PIN, "pin"},
    {ChromotingEvent::AuthMethod::ACCESS_CODE, "access-code"},
    {ChromotingEvent::AuthMethod::PINLESS, "pinless"},
    {ChromotingEvent::AuthMethod::THIRD_PARTY, "third-party"},
};

const NameMapElement<ChromotingEvent::ConnectionError> kConnectionErrorNames[]{
    {ChromotingEvent::ConnectionError::NONE, "none"},
    {ChromotingEvent::ConnectionError::HOST_OFFLINE, "host-offline"},
    {ChromotingEvent::ConnectionError::SESSION_REJECTED, "session-rejected"},
    {ChromotingEvent::ConnectionError::INCOMPATIBLE_PROTOCOL,
     "incompatible-protocol"},
    {ChromotingEvent::ConnectionError::NETWORK_FAILURE, "network-failure"},
    {ChromotingEvent::ConnectionError::UNKNOWN_ERROR, "unknown-error"},
    {ChromotingEvent::ConnectionError::INVALID_ACCESS_CODE,
     "invalid-access-code"},
    {ChromotingEvent::ConnectionError::MISSING_PLUGIN, "missing-plugin"},
    {ChromotingEvent::ConnectionError::AUTHENTICATION_FAILED,
     "authentication-failed"},
    {ChromotingEvent::ConnectionError::BAD_VERSION, "bad-version"},
    {ChromotingEvent::ConnectionError::HOST_OVERLOAD, "host-overload"},
    {ChromotingEvent::ConnectionError::P2P_FAILURE, "p2p-failure"},
    {ChromotingEvent::ConnectionError::UNEXPECTED, "unexpected"},
    {ChromotingEvent::ConnectionError::CLIENT_SUSPENDED, "client-suspended"},
    {ChromotingEvent::ConnectionError::NACL_DISABLED, "nacl-disabled"},
    {ChromotingEvent::ConnectionError::MAX_SESSION_LENGTH,
     "max-session-length"},
    {ChromotingEvent::ConnectionError::HOST_CONFIGURATION_ERROR,
     "host-configuration-error"},
    {ChromotingEvent::ConnectionError::NACL_PLUGIN_CRASHED,
     "nacl-plugin-crashed"},
    {ChromotingEvent::ConnectionError::INVALID_ACCOUNT, "invalid-account"},
};

const NameMapElement<ChromotingEvent::ConnectionType> kConnectionTypeNames[]{
    {ChromotingEvent::ConnectionType::DIRECT, "direct"},
    {ChromotingEvent::ConnectionType::STUN, "stun"},
    {ChromotingEvent::ConnectionType::RELAY, "relay"},
};

const NameMapElement<ChromotingEvent::Mode> kModeNames[]{
    {ChromotingEvent::Mode::IT2ME, "it2me"},
    {ChromotingEvent::Mode::ME2ME, "me2me"},
};

const NameMapElement<ChromotingEvent::Os> kOsNames[] = {
    {ChromotingEvent::Os::CHROMOTING_LINUX, "linux"},
    {ChromotingEvent::Os::CHROMOTING_CHROMEOS, "chromeos"},
    {ChromotingEvent::Os::CHROMOTING_MAC, "mac"},
    {ChromotingEvent::Os::CHROMOTING_WINDOWS, "windows"},
    {ChromotingEvent::Os::OTHER, "other"},
    {ChromotingEvent::Os::CHROMOTING_ANDROID, "android"},
    {ChromotingEvent::Os::CHROMOTING_IOS, "ios"},
};

const NameMapElement<ChromotingEvent::SessionState> kSessionStateNames[]{
    {ChromotingEvent::SessionState::UNKNOWN, "unknown"},
    {ChromotingEvent::SessionState::CREATED, "created"},
    {ChromotingEvent::SessionState::BAD_PLUGIN_VERSION, "bad-plugin-version"},
    {ChromotingEvent::SessionState::UNKNOWN_PLUGIN_ERROR,
     "unknown-plugin-error"},
    {ChromotingEvent::SessionState::CONNECTING, "connecting"},
    {ChromotingEvent::SessionState::INITIALIZING, "initializing"},
    {ChromotingEvent::SessionState::CONNECTED, "connected"},
    {ChromotingEvent::SessionState::CLOSED, "closed"},
    {ChromotingEvent::SessionState::CONNECTION_FAILED, "connection-failed"},
    {ChromotingEvent::SessionState::UNDEFINED, "undefined"},
    {ChromotingEvent::SessionState::PLUGIN_DISABLED, "plugin-disabled"},
    {ChromotingEvent::SessionState::CONNECTION_DROPPED, "connection-dropped"},
    {ChromotingEvent::SessionState::CONNECTION_CANCELED, "connection-canceled"},
    {ChromotingEvent::SessionState::AUTHENTICATED, "authenticated"},
    {ChromotingEvent::SessionState::STARTED, "started"},
    {ChromotingEvent::SessionState::SIGNALING, "signaling"},
    {ChromotingEvent::SessionState::CREATING_PLUGIN, "creating-plugin"},
};

}  // namespace

const char ChromotingEvent::kAuthMethodKey[] =;
const char ChromotingEvent::kCaptureLatencyKey[] =;
const char ChromotingEvent::kConnectionErrorKey[] =;
const char ChromotingEvent::kConnectionTypeKey[] =;
const char ChromotingEvent::kCpuKey[] =;
const char ChromotingEvent::kDecodeLatencyKey[] =;
const char ChromotingEvent::kEncodeLatencyKey[] =;
const char ChromotingEvent::kHostOsKey[] =;
const char ChromotingEvent::kHostOsVersionKey[] =;
const char ChromotingEvent::kHostVersionKey[] =;
const char ChromotingEvent::kMaxCaptureLatencyKey[] =;
const char ChromotingEvent::kMaxDecodeLatencyKey[] =;
const char ChromotingEvent::kMaxEncodeLatencyKey[] =;
const char ChromotingEvent::kMaxRenderLatencyKey[] =;
const char ChromotingEvent::kMaxRoundtripLatencyKey[] =;
const char ChromotingEvent::kModeKey[] =;
const char ChromotingEvent::kOsKey[] =;
const char ChromotingEvent::kOsVersionKey[] =;
const char ChromotingEvent::kPreviousSessionStateKey[] =;
const char ChromotingEvent::kRenderLatencyKey[] =;
const char ChromotingEvent::kRoleKey[] =;
const char ChromotingEvent::kRoundtripLatencyKey[] =;
const char ChromotingEvent::kSessionDurationKey[] =;
const char ChromotingEvent::kSessionEntryPointKey[] =;
const char ChromotingEvent::kSessionIdKey[] =;
const char ChromotingEvent::kSessionStateKey[] =;
const char ChromotingEvent::kSignalStrategyTypeKey[] =;
const char ChromotingEvent::kTypeKey[] =;
const char ChromotingEvent::kVideoBandwidthKey[] =;
const char ChromotingEvent::kWebAppVersionKey[] =;

ChromotingEvent::ChromotingEvent()
    :{}

ChromotingEvent::ChromotingEvent(Type type) :{}

ChromotingEvent::ChromotingEvent(const ChromotingEvent& other) {}

ChromotingEvent::ChromotingEvent(ChromotingEvent&& other) {}

ChromotingEvent::~ChromotingEvent() = default;

ChromotingEvent& ChromotingEvent::operator=(const ChromotingEvent& other) {}

ChromotingEvent& ChromotingEvent::operator=(ChromotingEvent&& other) {}

void ChromotingEvent::SetString(const std::string& key,
                                const std::string& value) {}

void ChromotingEvent::SetInteger(const std::string& key, int value) {}

void ChromotingEvent::SetBoolean(const std::string& key, bool value) {}

void ChromotingEvent::SetDouble(const std::string& key, double value) {}

bool ChromotingEvent::IsDataValid() {}

void ChromotingEvent::AddSystemInfo() {}

void ChromotingEvent::IncrementSendAttempts() {}

const base::Value* ChromotingEvent::GetValue(const std::string& key) const {}

std::unique_ptr<base::Value::Dict> ChromotingEvent::CopyDictionaryValue()
    const {}

// TODO(rkjnsn): Ideally we'd use the protobuf directly instead of storing
// everything in a DictionaryValue that needs to be converted.
apis::v1::ChromotingEvent ChromotingEvent::CreateProto() const {}

// static
bool ChromotingEvent::IsEndOfSession(SessionState state) {}

// static
ChromotingEvent::Os ChromotingEvent::ParseOsFromString(const std::string& os) {}

// static
template <>
const char* ChromotingEvent::EnumToString(AuthMethod value) {}

// static
template <>
const char* ChromotingEvent::EnumToString(ConnectionError value) {}

// static
template <>
const char* ChromotingEvent::EnumToString(ConnectionType value) {}

// static
template <>
const char* ChromotingEvent::EnumToString(Mode value) {}

// static
template <>
const char* ChromotingEvent::EnumToString(Os value) {}

// static
template <>
const char* ChromotingEvent::EnumToString(SessionState value) {}

}  // namespace remoting