chromium/components/omnibox/browser/actions/omnibox_action_in_suggest.cc

// Copyright 2023 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_action_in_suggest.h"

#include "base/metrics/histogram_functions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/omnibox/browser/actions/omnibox_action_concepts.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"

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

namespace {
// UMA reported Type of ActionInSuggest.
//
// Automatically generate a corresponding Java enum:
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.omnibox.action
// GENERATED_JAVA_CLASS_NAME_OVERRIDE: ActionInSuggestUmaType
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused. The values should remain
// synchronized with the enum AutocompleteMatchType in
// //tools/metrics/histograms/enums.xml.
enum class ActionInSuggestUmaType {};

constexpr const char* ToUmaUsageHistogramName(
    omnibox::ActionInfo::ActionType type) {}

// Get the UMA action type from ActionInfo::ActionType.
constexpr ActionInSuggestUmaType ToUmaActionType(
    omnibox::ActionInfo::ActionType action_type) {}

constexpr int ToActionHint(omnibox::ActionInfo::ActionType action_type) {}

constexpr int ToActionContents(omnibox::ActionInfo::ActionType action_type) {}
}  // namespace

OmniboxActionInSuggest::OmniboxActionInSuggest(
    omnibox::ActionInfo action_info,
    std::optional<TemplateURLRef::SearchTermsArgs> search_terms_args)
    :{}

OmniboxActionInSuggest::~OmniboxActionInSuggest() = default;

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

void OmniboxActionInSuggest::RecordActionShown(size_t position,
                                               bool used) const {}

void OmniboxActionInSuggest::Execute(ExecutionContext& context) const {}

OmniboxActionId OmniboxActionInSuggest::ActionId() const {}

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

// static
OmniboxActionInSuggest* OmniboxActionInSuggest::FromAction(
    OmniboxAction* action) {}

// static
void OmniboxActionInSuggest::RecordShownAndUsedMetrics(
    omnibox::ActionInfo::ActionType type,
    bool used) {}

omnibox::ActionInfo::ActionType OmniboxActionInSuggest::Type() const {}