#ifndef CHROME_BROWSER_UI_VIEWS_COMMERCE_PRICE_TRACKING_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_COMMERCE_PRICE_TRACKING_ICON_VIEW_H_
#include <string_view>
#include "base/memory/raw_ptr.h"
#include "base/timer/timer.h"
#include "chrome/browser/ui/views/commerce/price_tracking_bubble_dialog_view.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/gfx/vector_icon_types.h"
class Browser;
class Profile;
class ScopedWindowCallToAction;
class PriceTrackingIconView : public PageActionIconView {
METADATA_HEADER(PriceTrackingIconView, PageActionIconView)
public:
PriceTrackingIconView(IconLabelBubbleView::Delegate* parent_delegate,
Delegate* delegate,
Browser* browser);
~PriceTrackingIconView() override;
views::BubbleDialogDelegate* GetBubble() const override;
void OnExecuting(PageActionIconView::ExecuteSource execute_source) override;
const gfx::VectorIcon& GetVectorIcon() const override;
void ForceVisibleForTesting(bool is_tracking_price);
std::u16string_view GetIconLabelForTesting() const;
void SetOneShotTimerForTesting(base::OneShotTimer* animate_out_timer);
protected:
void UpdateImpl() override;
private:
void AnimationProgressed(const gfx::Animation* animation) override;
void EnablePriceTracking(bool enable);
void SetVisualState(bool enable);
void OnPriceTrackingServerStateUpdated(bool success);
bool ShouldShow();
bool IsPriceTracking() const;
bool ShouldShowFirstUseExperienceBubble() const;
void MaybeShowPageActionLabel();
void HidePageActionLabel();
base::OneShotTimer& AnimateOutTimer();
const raw_ptr<Browser> browser_;
const raw_ptr<Profile> profile_;
PriceTrackingBubbleCoordinator bubble_coordinator_;
raw_ptr<const gfx::VectorIcon> icon_;
base::OneShotTimer animate_out_timer_;
raw_ptr<base::OneShotTimer> animate_out_timer_for_testing_ = nullptr;
bool should_extend_label_shown_duration_ = false;
std::unique_ptr<ScopedWindowCallToAction> scoped_window_call_to_action_ptr_;
base::WeakPtrFactory<PriceTrackingIconView> weak_ptr_factory_{this};
};
#endif