#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 {
std::string GetDataCollectorName(
support_tool::DataCollectorType data_collector_type) { … }
void InitDataCollectionModuleFromURLQuery(
support_tool::DataCollectionModule* module,
const std::string& module_query) { … }
base::Value::Dict GetDataCollectorItemForType(
const support_tool::DataCollectionModule& module,
const support_tool::DataCollectorType& type) { … }
base::Value::Dict GetDataCollectorItemForType(
const support_tool::DataCollectorType& type) { … }
std::string GetDataCollectionModuleQuery(
std::set<support_tool::DataCollectorType> included_data_collectors) { … }
base::Value::Dict GetSupportTokenGenerationResult(bool success,
std::string result,
std::string error_message) { … }
}
std::string GetPIITypeDescription(redaction::PIIType type_enum) { … }
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) { … }