chromium/chrome/browser/ui/webui/support_tool/support_tool_ui_utils.cc

// Copyright 2022 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/ui/webui/support_tool/support_tool_ui_utils.h"

#include <map>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <vector>

#include "base/base64url.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/containers/to_value_list.h"
#include "base/strings/string_util.h"
#include "base/values.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/support_tool/data_collection_module.pb.h"
#include "chrome/browser/support_tool/data_collector.h"
#include "chrome/browser/support_tool/support_tool_util.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/feedback/redaction_tool/pii_types.h"
#include "net/base/url_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

namespace support_tool_ui {

const char kPiiItemDescriptionKey[] =;
const char kPiiItemDetectedDataKey[] =;
const char kPiiItemPIITypeKey[] =;
const char kPiiItemCountKey[] =;
const char kPiiItemKeepKey[] =;

const char kSupportCaseIDQuery[] =;
const char kModuleQuery[] =;

const char kDataCollectorName[] =;
const char kDataCollectorProtoEnum[] =;
const char kDataCollectorIncluded[] =;

const char kSupportTokenGenerationResultSuccess[] =;
const char kSupportTokenGenerationResultToken[] =;
const char kSupportTokenGenerationResultErrorMessage[] =;

}  // namespace support_tool_ui

namespace {

// Returns the human readable name corresponding to `data_collector_type`.
std::string GetDataCollectorName(
    support_tool::DataCollectorType data_collector_type) {}

// Decodes `module_query` string and initializes contents of `module`.
void InitDataCollectionModuleFromURLQuery(
    support_tool::DataCollectionModule* module,
    const std::string& module_query) {}

// Returns data collector item for `type`. Sets isIncluded field true if
// `module` contains `type`.
base::Value::Dict GetDataCollectorItemForType(
    const support_tool::DataCollectionModule& module,
    const support_tool::DataCollectorType& type) {}

// Returns data collector item for `type`. Sets isIncluded to false for all data
// collector items.
base::Value::Dict GetDataCollectorItemForType(
    const support_tool::DataCollectorType& type) {}

std::string GetDataCollectionModuleQuery(
    std::set<support_tool::DataCollectorType> included_data_collectors) {}

// Returns a URL generation result in the type Support Tool UI expects.
// type SupportTokenGenerationResult = {
//   success: boolean,
//   token: string,
//   errorMessage: string,
// }
base::Value::Dict GetSupportTokenGenerationResult(bool success,
                                                  std::string result,
                                                  std::string error_message) {}

}  // namespace

// Returns the human readable name corresponding to `type_enum`.
std::string GetPIITypeDescription(redaction::PIIType type_enum) {}

// type PIIDataItem = {
//   piiTypeDescription: string,
//   piiType: number,
//   detectedData: List<string>,
//   count: number,
//   keep: boolean,
// }
base::Value::List GetDetectedPIIDataItems(const PIIMap& detected_pii) {}

std::set<redaction::PIIType> GetPIITypesToKeep(
    const base::Value::List* pii_items) {}

std::string GetSupportCaseIDFromURL(const GURL& url) {}

base::Value::List GetDataCollectorItemsInQuery(std::string module_query) {}

base::Value::List GetAllDataCollectorItems() {}

base::Value::List GetAllDataCollectorItemsForDeviceForTesting() {}

std::set<support_tool::DataCollectorType> GetIncludedDataCollectorTypes(
    const base::Value::List* data_collector_items) {}

base::Value::Dict GetStartDataCollectionResult(bool success,
                                               std::u16string error_message) {}

base::Value::Dict GenerateCustomizedURL(
    std::string case_id,
    const base::Value::List* data_collector_items) {}

base::Value::Dict GenerateSupportToken(
    const base::Value::List* data_collector_items) {}