blob: 015dbdc0a7f45ce78d8c99fca3bf3e878921a1dc [file] [log] [blame]
// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_BUBBLE_CONTROLLER_BASE_H_
#define CHROME_BROWSER_UI_AUTOFILL_BUBBLE_CONTROLLER_BASE_H_
#include "base/memory/weak_ptr.h"
namespace autofill {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
// LINT.IfChange(BubbleType)
enum class BubbleType {
// Denotes the save/update address bubble.
kSaveUpdateAddress = 0,
// Denotes bubble for saving a new IBAN.
kSaveIban = 1,
// Denotes bubble for saving/updating a credit card.
kSaveUpdateCard = 2,
// Denotes bubble for saving/updating autofill ai data.
kSaveUpdateAutofillAi = 3,
// Denotes bubble for virtual card enrollment confirmation.
kVirtualCardEnrollConfirmation = 4,
// Denotes bubble for mandatory reauth types.
kMandatoryReauth = 5,
// Denotes bubble for offer notifications.
kOfferNotification = 6,
// Denotes bubble for filled card information.
kFilledCardInformation = 7,
// Denotes password related bubbles.
kPassword = 8,
// Denotes bubble for walletable pass detection consent.
kWalletablePassConsent = 9,
kMaxValue = kWalletablePassConsent
};
// LINT.ThenChange(/tools/metrics/histograms/metadata/autofill/enums.xml:AutofillBubbleType)
// This class serves as the base for all bubble controllers, which manage the
// logic and state of an Autofill bubble.
class BubbleControllerBase {
public:
virtual ~BubbleControllerBase() = default;
// Instructs the controller to show the bubble view.
virtual void ShowBubble() = 0;
// Instructs the controller to hide the bubble view.
virtual void HideBubble() = 0;
// Returns the corresponding `BubbleType` for the controller.
virtual BubbleType GetBubbleType() const = 0;
// Returns true if the bubble is currently visible.
virtual bool IsShowingBubble() const = 0;
// Returns true if the mouse is currently inside the bubble view.
virtual bool IsMouseHovered() const = 0;
// Subclasses need to implement this method so that the resulting weak
// pointers are invalidated as soon as the derived class is destroyed.
virtual base::WeakPtr<BubbleControllerBase>
GetBubbleControllerBaseWeakPtr() = 0;
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_BUBBLE_CONTROLLER_BASE_H_