chromium/chrome/browser/ui/views/omnibox/omnibox_text_view.cc

// Copyright 2018 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/views/omnibox/omnibox_text_view.h"

#include <limits.h>

#include <algorithm>
#include <memory>
#include <optional>

#include "base/feature_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/omnibox/omnibox_theme.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/common/omnibox_features.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/range/range.h"
#include "ui/gfx/render_text.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"

namespace {

// Use the primary style for everything. TextStyle sometimes controls color, but
// we use OmniboxTheme for that.
constexpr int kTextStyle =;

// Indicates to use CONTEXT_OMNIBOX_PRIMARY when picking a font size in legacy
// code paths.
constexpr int kInherit =;

// The vertical padding to provide each RenderText in addition to the height
// of the font. Where possible, RenderText uses this additional space to
// vertically center the cap height of the font instead of centering the
// entire font.
static constexpr int kVerticalPadding =;

// Dictionary and translation default number of lines for the FormattedString
// subhead.
constexpr size_t kDefaultMaxNumLines =;

struct TextStyle {};

// The new answer layout has separate and different treatment of text styles,
// and as of writing both styling approaches need to be supported.  When old
// answer styles are deprecated, the above TextStyle structure and related
// logic can be removed, and this used exclusively.  This utility function
// applies new answer text styling for given text_type over range on render_text
// using result_view as a source for omnibox part colors.
void ApplyTextStyleForType(SuggestionAnswer::TextStyle text_style,
                           OmniboxResultView* result_view,
                           gfx::RenderText* render_text,
                           const gfx::Range& range) {}

void ApplyTextStyleFromColorType(
    const std::optional<omnibox::FormattedString::ColorType>& color_type,
    OmniboxResultView* result_view,
    gfx::RenderText* render_text,
    const gfx::Range& range) {}

// Dictionary and translation answers have a max number of lines > 1.
bool AnswerHasDefinedMaxLines(omnibox::AnswerType answer_type) {}

}  // namespace

OmniboxTextView::OmniboxTextView(OmniboxResultView* result_view)
    :{}

OmniboxTextView::~OmniboxTextView() = default;

gfx::Size OmniboxTextView::CalculatePreferredSize(
    const views::SizeBounds& available_size) const {}

bool OmniboxTextView::GetCanProcessEventsWithinSubtree() const {}

void OmniboxTextView::OnPaint(gfx::Canvas* canvas) {}

void OmniboxTextView::ApplyTextColor(ui::ColorId id) {}

const std::u16string& OmniboxTextView::GetText() const {}

void OmniboxTextView::SetText(const std::u16string& new_text) {}

void OmniboxTextView::SetTextWithStyling(
    const std::u16string& new_text,
    const ACMatchClassifications& classifications,
    bool deemphasize) {}

void OmniboxTextView::SetTextWithStyling(
    const SuggestionAnswer::ImageLine& line,
    bool deemphasize) {}

void OmniboxTextView::SetTextWithStyling(
    const omnibox::FormattedString& formatted_string,
    size_t fragment_index,
    const omnibox::AnswerType& answer_type) {}

void OmniboxTextView::SetMultilineText(
    const omnibox::FormattedString& formatted_string,
    const omnibox::AnswerType& answer_type) {}

void OmniboxTextView::AppendExtraText(const SuggestionAnswer::ImageLine& line) {}

int OmniboxTextView::GetLineHeight() const {}

void OmniboxTextView::ReapplyStyling() {}

std::unique_ptr<gfx::RenderText> OmniboxTextView::CreateRenderText(
    const std::u16string& text) const {}

void OmniboxTextView::AppendText(const SuggestionAnswer::TextField& field,
                                 const std::u16string& prefix) {}

void OmniboxTextView::OnStyleChanged() {}

BEGIN_METADATA()