chromium/components/omnibox/browser/actions/omnibox_action.h

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

#ifndef COMPONENTS_OMNIBOX_BROWSER_ACTIONS_OMNIBOX_ACTION_H_
#define COMPONENTS_OMNIBOX_BROWSER_ACTIONS_OMNIBOX_ACTION_H_

#include <string>

#include "base/functional/callback.h"
#include "base/memory/raw_ref.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/omnibox/browser/actions/omnibox_action_concepts.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/buildflags.h"
#include "components/search_engines/template_url.h"
#include "components/url_formatter/spoof_checks/idna_metrics.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/color_utils.h"
#include "url/gurl.h"

#if (!BUILDFLAG(IS_ANDROID) || BUILDFLAG(ENABLE_VR)) && !BUILDFLAG(IS_IOS)
#define SUPPORT_PEDALS_VECTOR_ICONS
namespace gfx {
struct VectorIcon;
}
#endif

#if BUILDFLAG(IS_ANDROID)
#include "base/android/scoped_java_ref.h"
#endif

class AutocompleteInput;
class AutocompleteProviderClient;

// Omnibox Actions are additional actions associated with matches. They appear
// in the suggestion button row and are not matches themselves.
//
// Omnibox Pedals are a type of Omnibox Action.
//
// Actions are ref-counted to support a flexible ownership model.
//  - Some actions are ephemeral and specific to the match, and should be
//    destroyed when the match is destroyed, so matches have the only reference.
//  - Some actions (like Pedals) are fixed and expensive to copy, so matches
//    should merely hold one of the references to the action.
// Note: `RefCountedThreadSafe` is used instead of `RefCounted` because
//  AutocompleteMatch instances are passed across thread boundaries to
//  different sequences and they contain `scoped_refptr<OmniboxAction>`.
class OmniboxAction : public base::RefCountedThreadSafe<OmniboxAction> {};

#endif  // COMPONENTS_OMNIBOX_BROWSER_ACTIONS_OMNIBOX_ACTION_H_