chromium/chrome/browser/devtools/device/cast_device_provider.cc

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

#include "chrome/browser/devtools/device/cast_device_provider.h"

#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/local_discovery/service_discovery_shared_client.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/host_port_pair.h"
#include "net/base/ip_address.h"

ServiceDescription;
ServiceDiscoveryDeviceLister;
ServiceDiscoverySharedClient;

namespace {

const int kCastInspectPort =;
const char kCastServiceType[] =;
const char kUnknownCastDevice[] =;

ServiceTxtRecordMap;

// Parses TXT record strings into a map. TXT key-value strings are assumed to
// follow the form "$key(=$value)?", where $key must contain at least one
// character, and $value may be empty.
std::unique_ptr<ServiceTxtRecordMap> ParseServiceTxtRecord(
    const std::vector<std::string>& record) {}

// Returns the value in the TXT |record_map| for the two-character |key|, or
// |default_value| if |key| was not found.
std::string GetServiceMapValue(const ServiceTxtRecordMap& record_map,
                               const std::string& key,
                               const char* default_value) {}

AndroidDeviceManager::DeviceInfo ServiceDescriptionToDeviceInfo(
    const ServiceDescription& service_description) {}

}  // namespace

// The purpose of this class is to route lister delegate signals from
// ServiceDiscoveryDeviceLister (on the UI thread) to CastDeviceProvider (on the
// DevTools ADB thread). Cancellable callbacks are necessary since
// CastDeviceProvider and ServiceDiscoveryDeviceLister are destroyed on
// different threads in undefined order.
//
// TODO(crbug.com/963216): Consolidate DNS-SD implementations for Cast.
class CastDeviceProvider::DeviceListerDelegate final
    : public ServiceDiscoveryDeviceLister::Delegate {};

CastDeviceProvider::CastDeviceProvider() {}

CastDeviceProvider::~CastDeviceProvider() {}

void CastDeviceProvider::QueryDevices(SerialsCallback callback) {}

void CastDeviceProvider::QueryDeviceInfo(const std::string& serial,
                                         DeviceInfoCallback callback) {}

void CastDeviceProvider::OpenSocket(const std::string& serial,
                                    const std::string& socket_name,
                                    SocketCallback callback) {}

void CastDeviceProvider::OnDeviceChanged(
    const std::string& service_type,
    bool added,
    const ServiceDescription& service_description) {}

void CastDeviceProvider::OnDeviceRemoved(const std::string& service_type,
                                         const std::string& service_name) {}

void CastDeviceProvider::OnDeviceCacheFlushed(const std::string& service_type) {}

void CastDeviceProvider::OnPermissionRejected() {}