chromium/chrome/browser/ui/autofill/autofill_context_menu_manager.cc

// Copyright 2022 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/autofill/autofill_context_menu_manager.h"

#include <optional>
#include <string>

#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/weak_ptr.h"
#include "base/notimplemented.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/values.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/feedback/show_feedback_page.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
#include "chrome/browser/plus_addresses/plus_address_service_factory.h"
#include "chrome/browser/ui/autofill/address_bubbles_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/passwords/ui_utils.h"
#include "chrome/browser/user_education/user_education_service.h"
#include "chrome/grit/generated_resources.h"
#include "components/autofill/content/browser/content_autofill_client.h"
#include "components/autofill/content/browser/content_autofill_driver.h"
#include "components/autofill/core/browser/address_data_manager.h"
#include "components/autofill/core/browser/autofill_driver.h"
#include "components/autofill/core/browser/autofill_feedback_data.h"
#include "components/autofill/core/browser/autofill_prediction_improvements_delegate.h"
#include "components/autofill/core/browser/browser_autofill_manager.h"
#include "components/autofill/core/browser/data_model/autofill_profile.h"
#include "components/autofill/core/browser/field_type_utils.h"
#include "components/autofill/core/browser/filling_product.h"
#include "components/autofill/core/browser/form_types.h"
#include "components/autofill/core/browser/metrics/address_save_metrics.h"
#include "components/autofill/core/browser/metrics/fallback_autocomplete_unrecognized_metrics.h"
#include "components/autofill/core/browser/metrics/manual_fallback_metrics.h"
#include "components/autofill/core/browser/payments_data_manager.h"
#include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/aliases.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/unique_ids.h"
#include "components/autofill_prediction_improvements/core/browser/autofill_prediction_improvements_features.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/password_manager/content/browser/content_password_manager_driver.h"
#include "components/password_manager/core/browser/features/password_features.h"
#include "components/password_manager/core/browser/password_autofill_manager.h"
#include "components/password_manager/core/browser/password_manager_client.h"
#include "components/password_manager/core/browser/password_manager_util.h"
#include "components/password_manager/core/browser/password_manual_fallback_flow.h"
#include "components/password_manager/core/browser/password_manual_fallback_metrics_recorder.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/plus_addresses/features.h"
#include "components/plus_addresses/plus_address_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/variations/service/variations_service.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/menu_model.h"

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "components/plus_addresses/resources/vector_icons.h"
#endif

namespace autofill {

FillingProductSet;

namespace {

ContentPasswordManagerDriver;

constexpr char kFeedbackPlaceholder[] =;

// Constant determining the icon size in the context menu.
constexpr int kContextMenuIconSize =;

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
const gfx::VectorIcon& kPlusAddressLogoIcon =
    plus_addresses::kPlusAddressLogoSmallIcon;
#else
const gfx::VectorIcon& kPlusAddressLogoIcon =;
#endif

bool ShouldShowAutofillContextMenu(const content::ContextMenuParams& params) {}

// Returns true if the given id is one generated for autofill context menu.
bool IsAutofillCustomCommandId(
    AutofillContextMenuManager::CommandId command_id) {}

bool IsLikelyDogfoodClient() {}

// Returns true if the field is a username or password field.
bool IsPasswordFormField(ContentPasswordManagerDriver& password_manager_driver,
                         const content::ContextMenuParams& params) {}

// Returns true if the user has autofillable passwords saved.
bool UserHasPasswordsSaved(
    ContentPasswordManagerDriver& password_manager_driver) {}

base::Value::Dict LoadTriggerFormAndFieldLogs(
    AutofillManager& manager,
    const LocalFrameToken& frame_token,
    const content::ContextMenuParams& params) {}

}  // namespace

AutofillContextMenuManager::AutofillContextMenuManager(
    PersonalDataManager* personal_data_manager,
    RenderViewContextMenuBase* delegate,
    ui::SimpleMenuModel* menu_model)
    :{}

AutofillContextMenuManager::~AutofillContextMenuManager() = default;

void AutofillContextMenuManager::AppendItems() {}

bool AutofillContextMenuManager::IsCommandIdSupported(int command_id) {}

bool AutofillContextMenuManager::IsCommandIdEnabled(int command_id) {}

void AutofillContextMenuManager::ExecuteCommand(int command_id) {}

void AutofillContextMenuManager::MaybeAddAutofillFeedbackItem() {}

void AutofillContextMenuManager::MaybeAddAutofillManualFallbackItems() {}

bool AutofillContextMenuManager::ShouldAddPlusAddressManualFallbackItem(
    ContentAutofillDriver& autofill_driver) {}

bool AutofillContextMenuManager::ShouldAddPredictionImprovementsItem(
    AutofillPredictionImprovementsDelegate* delegate,
    const GURL& url) {}

bool AutofillContextMenuManager::ShouldAddAddressManualFallbackItem(
    ContentAutofillDriver& autofill_driver) {}

bool AutofillContextMenuManager::ShouldAddPasswordsManualFallbackItem(
    ContentPasswordManagerDriver& password_manager_driver) {}

void AutofillContextMenuManager::AddPasswordsManualFallbackItems(
    ContentPasswordManagerDriver& password_manager_driver) {}

void AutofillContextMenuManager::LogAddressManualFallbackContextMenuEntryShown(
    ContentAutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::LogPaymentsManualFallbackContextMenuEntryShown(
    ContentAutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::
    LogSelectPasswordManualFallbackContextMenuEntryShown(
        ContentPasswordManagerDriver& password_manager_driver) {}

void AutofillContextMenuManager::
    LogAddressManualFallbackContextMenuEntryAccepted(
        AutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::
    LogPaymentsManualFallbackContextMenuEntryAccepted(
        AutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::
    LogSelectPasswordManualFallbackContextMenuEntryAccepted() {}

void AutofillContextMenuManager::ExecutePredictionImprovementsCommand(
    const LocalFrameToken& frame_token,
    ContentAutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::ExecuteAutofillFeedbackCommand(
    const LocalFrameToken& frame_token,
    AutofillManager& manager) {}

void AutofillContextMenuManager::ExecuteFallbackForPlusAddressesCommand(
    AutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::ExecuteFallbackForPaymentsCommand(
    AutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::ExecuteFallbackForSelectPasswordCommand(
    AutofillDriver& autofill_driver) {}

void AutofillContextMenuManager::ExecuteFallbackForAddressesCommand(
    ContentAutofillDriver& autofill_driver) {}

AutofillField* AutofillContextMenuManager::GetAutofillField(
    AutofillDriver& autofill_driver) const {}

}  // namespace autofill