chromium/ui/base/webui/web_ui_util.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/base/webui/web_ui_util.h"

#include <string_view>
#include <vector>

#include "base/base64.h"
#include "base/i18n/rtl.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/template_expressions.h"
#include "ui/base/window_open_disposition.h"
#include "ui/base/window_open_disposition_utils.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/font.h"
#include "ui/resources/grit/webui_resources.h"
#include "ui/strings/grit/app_locale_settings.h"
#include "url/gurl.h"

#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif

namespace webui {
namespace {

// Generous cap to guard against out-of-memory issues.
constexpr float kMaxScaleFactor =;

std::string GetFontFamilyMd() {}

std::string GetWebUiCssTextDefaults(const std::string& css_template) {}

}  // namespace

std::string GetBitmapDataUrl(const SkBitmap& bitmap) {}

std::string GetPngDataUrl(const unsigned char* data, size_t size) {}

WindowOpenDisposition GetDispositionFromClick(const base::Value::List& list,
                                              size_t start_index) {}

bool ParseScaleFactor(std::string_view identifier, float* scale_factor) {}

// Parse a formatted frame index string into int and sets to |frame_index|.
bool ParseFrameIndex(std::string_view identifier, int* frame_index) {}

void ParsePathAndImageSpec(const GURL& url,
                           std::string* path,
                           float* scale_factor,
                           int* frame_index) {}

void SetLoadTimeDataDefaults(const std::string& app_locale,
                             base::Value::Dict* localized_strings) {}

void SetLoadTimeDataDefaults(const std::string& app_locale,
                             ui::TemplateReplacements* replacements) {}

std::string GetWebUiCssTextDefaults() {}

void AppendWebUiCssTextDefaults(std::string* html) {}

std::string GetFontFamily() {}

std::string GetFontSize() {}

std::string GetTextDirection() {}

std::string GetLocalizedHtml(std::string_view html_template,
                             const base::Value::Dict& strings) {}

}  // namespace webui