chromium/components/dom_distiller/core/viewer.cc

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

#include "components/dom_distiller/core/viewer.h"

#include <memory>
#include <string>
#include <vector>

#include "base/json/json_writer.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/escape.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "build/blink_buildflags.h"
#include "build/build_config.h"
#include "components/dom_distiller/core/distilled_page_prefs.h"
#include "components/dom_distiller/core/dom_distiller_service.h"
#include "components/dom_distiller/core/experiments.h"
#include "components/dom_distiller/core/proto/distilled_article.pb.h"
#include "components/dom_distiller/core/proto/distilled_page.pb.h"
#include "components/dom_distiller/core/task_tracker.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/dom_distiller/core/url_utils.h"
#include "components/grit/components_resources.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/template_expressions.h"
#include "url/gurl.h"

namespace dom_distiller {
namespace viewer {

namespace {

// JS Themes. Must agree with useTheme() in dom_distiller_viewer.js.
const char kDarkJsTheme[] =;
const char kLightJsTheme[] =;
const char kSepiaJsTheme[] =;

// CSS Theme classes.  Must agree with classes in distilledpage.css.
const char kDarkCssClass[] =;
const char kLightCssClass[] =;
const char kSepiaCssClass[] =;

// JS FontFamilies. Must agree with useFontFamily() in dom_distiller_viewer.js.
const char kSerifJsFontFamily[] =;
const char kSansSerifJsFontFamily[] =;
const char kMonospaceJsFontFamily[] =;

// CSS FontFamily classes.  Must agree with classes in distilledpage.css.
const char kSerifCssClass[] =;
const char kSansSerifCssClass[] =;
const char kMonospaceCssClass[] =;

std::string GetPlatformSpecificCss() {}

// Maps themes to JS themes.
const std::string GetJsTheme(mojom::Theme theme) {}

// Maps themes to CSS classes.
const std::string GetThemeCssClass(mojom::Theme theme) {}

// Maps font families to JS font families.
const std::string GetJsFontFamily(mojom::FontFamily font_family) {}

// Maps fontFamilies to CSS fontFamily classes.
const std::string GetFontCssClass(mojom::FontFamily font_family) {}

void EnsureNonEmptyContent(std::string* content) {}

std::string ReplaceHtmlTemplateValues(const mojom::Theme theme,
                                      const mojom::FontFamily font_family,
                                      const std::string& csp_nonce) {}

}  // namespace

const std::string GetUnsafeIncrementalDistilledPageJs(
    const DistilledPageProto* page_proto,
    bool is_last_page) {}

const std::string GetErrorPageJs() {}

const std::string GetSetTitleJs(std::string title) {}

const std::string GetSetTextDirectionJs(const std::string& direction) {}

const std::string GetToggleLoadingIndicatorJs(bool is_last_page) {}

const std::string GetArticleTemplateHtml(mojom::Theme theme,
                                         mojom::FontFamily font_family,
                                         const std::string& csp_nonce) {}

const std::string GetUnsafeArticleContentJs(
    const DistilledArticleProto* article_proto) {}

const std::string GetCss() {}

const std::string GetLoadingImage() {}

const std::string GetJavaScript() {}

std::unique_ptr<ViewerHandle> CreateViewRequest(
    DomDistillerServiceInterface* dom_distiller_service,
    const GURL& url,
    ViewRequestDelegate* view_request_delegate,
    const gfx::Size& render_view_size) {}

const std::string GetDistilledPageThemeJs(mojom::Theme theme) {}

const std::string GetDistilledPageFontFamilyJs(mojom::FontFamily font_family) {}

const std::string GetDistilledPageFontScalingJs(float scaling) {}

}  // namespace viewer
}  // namespace dom_distiller