chromium/components/omnibox/browser/actions/omnibox_pedal.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 "components/omnibox/browser/actions/omnibox_pedal.h"

#include <functional>
#include <numeric>

#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/memory_usage_estimator.h"
#include "build/build_config.h"
#include "components/omnibox/browser/buildflags.h"
#include "components/omnibox/browser/omnibox_client.h"
#include "components/omnibox/resources/grit/omnibox_pedal_synonyms.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"

#if defined(SUPPORT_PEDALS_VECTOR_ICONS)
#include "components/omnibox/browser/vector_icons.h"  // nogncheck
#endif

#if BUILDFLAG(IS_ANDROID)
#include "base/android/jni_android.h"
#include "components/omnibox/browser/actions/omnibox_action_factory_android.h"
#endif

OmniboxPedal::TokenSequence::TokenSequence(size_t reserve_size) {}

OmniboxPedal::TokenSequence::TokenSequence(std::vector<int> token_ids) {}

OmniboxPedal::TokenSequence::TokenSequence(OmniboxPedal::TokenSequence&&) =
    default;
OmniboxPedal::TokenSequence& OmniboxPedal::TokenSequence::operator=(
    OmniboxPedal::TokenSequence&&) = default;
OmniboxPedal::TokenSequence::~TokenSequence() = default;

bool OmniboxPedal::TokenSequence::IsFullyConsumed() {}

size_t OmniboxPedal::TokenSequence::CountUnconsumed() const {}

void OmniboxPedal::TokenSequence::Add(int id) {}

void OmniboxPedal::TokenSequence::ResetLinks() {}

bool OmniboxPedal::TokenSequence::Erase(
    const OmniboxPedal::TokenSequence& erase_sequence,
    bool erase_only_once) {}

bool OmniboxPedal::TokenSequence::Consume(
    const OmniboxPedal::TokenSequence& consume_sequence,
    bool consume_only_once) {}

size_t OmniboxPedal::TokenSequence::EstimateMemoryUsage() const {}

bool OmniboxPedal::TokenSequence::MatchesAt(
    const OmniboxPedal::TokenSequence& sequence,
    size_t index,
    size_t index_mask) const {}

size_t OmniboxPedal::TokenSequence::WalkToUnconsumedIndexFrom(
    size_t from_index) {}

// =============================================================================

OmniboxPedal::SynonymGroup::SynonymGroup(bool required,
                                         bool match_once,
                                         size_t reserve_size)
    :{}

OmniboxPedal::SynonymGroup::SynonymGroup(SynonymGroup&&) = default;

OmniboxPedal::SynonymGroup::~SynonymGroup() = default;

OmniboxPedal::SynonymGroup& OmniboxPedal::SynonymGroup::operator=(
    SynonymGroup&&) = default;

bool OmniboxPedal::SynonymGroup::EraseMatchesIn(
    OmniboxPedal::TokenSequence& remaining,
    bool fully_erase) const {}

void OmniboxPedal::SynonymGroup::AddSynonym(
    OmniboxPedal::TokenSequence synonym) {}

void OmniboxPedal::SynonymGroup::SortSynonyms() {}

size_t OmniboxPedal::SynonymGroup::EstimateMemoryUsage() const {}

void OmniboxPedal::SynonymGroup::EraseIgnoreGroup(
    const SynonymGroup& ignore_group) {}

bool OmniboxPedal::SynonymGroup::IsValid() const {}

// =============================================================================

OmniboxPedal::OmniboxPedal(OmniboxPedalId id, LabelStrings strings, GURL url)
    :{}

/* static */ const OmniboxPedal* OmniboxPedal::FromAction(
    const OmniboxAction* action) {}

OmniboxPedal::~OmniboxPedal() = default;

void OmniboxPedal::OnLoaded() {}

void OmniboxPedal::SetNavigationUrl(const GURL& url) {}

#if defined(SUPPORT_PEDALS_VECTOR_ICONS)
// static
const gfx::VectorIcon& OmniboxPedal::GetDefaultVectorIcon() {}

const gfx::VectorIcon& OmniboxPedal::GetVectorIcon() const {}
#endif

void OmniboxPedal::AddVerbatimSequence(TokenSequence sequence) {}

void OmniboxPedal::AddSynonymGroup(SynonymGroup&& group) {}

std::vector<OmniboxPedal::SynonymGroupSpec> OmniboxPedal::SpecifySynonymGroups(
    bool locale_is_english) const {}

OmniboxPedalId OmniboxPedal::GetMetricsId() const {}

bool OmniboxPedal::IsConceptMatch(TokenSequence& match_sequence) const {}

void OmniboxPedal::RecordActionShown(size_t /*position*/, bool executed) const {}

size_t OmniboxPedal::EstimateMemoryUsage() const {}

OmniboxActionId OmniboxPedal::ActionId() const {}

#if BUILDFLAG(IS_ANDROID)
base::android::ScopedJavaLocalRef<jobject> OmniboxPedal::GetOrCreateJavaObject(
    JNIEnv* env) const {
  if (!j_omnibox_action_) {
    j_omnibox_action_.Reset(
        BuildOmniboxPedal(env, reinterpret_cast<intptr_t>(this), strings_.hint,
                          strings_.accessibility_hint, PedalId()));
  }
  return base::android::ScopedJavaLocalRef<jobject>(j_omnibox_action_);
}
#endif

TestOmniboxPedalClearBrowsingData::TestOmniboxPedalClearBrowsingData()
    :{}

std::vector<OmniboxPedal::SynonymGroupSpec>
TestOmniboxPedalClearBrowsingData::SpecifySynonymGroups(
    bool locale_is_english) const {}