#include "chrome/browser/ui/views/commerce/discounts_bubble_dialog_view.h"
#include "base/functional/callback_forward.h"
#include "base/i18n/time_formatting.h"
#include "chrome/browser/ui/commerce/commerce_ui_tab_helper.h"
#include "chrome/browser/ui/tabs/public/tab_features.h"
#include "chrome/browser/ui/tabs/public/tab_interface.h"
#include "chrome/browser/ui/views/accessibility/theme_tracking_non_accessible_image_view.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/commerce/discounts_coupon_code_label_view.h"
#include "chrome/browser/ui/views/controls/page_switcher_view.h"
#include "chrome/browser/ui/views/controls/subpage_view.h"
#include "chrome/grit/theme_resources.h"
#include "components/commerce/core/commerce_types.h"
#include "components/commerce/core/metrics/discounts_metric_collector.h"
#include "components/strings/grit/components_strings.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/web_contents.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_tracker.h"
#include "url/gurl.h"
DEFINE_ELEMENT_IDENTIFIER_VALUE(kDiscountsBubbleDialogId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kDiscountsBubbleMainPageId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kDiscountsBubbleTermsAndConditionLabelId);
DEFINE_ELEMENT_IDENTIFIER_VALUE(kDiscountsBubbleTermsAndConditionPageId);
DiscountsBubbleDialogView::DiscountsBubbleDialogView(
View* anchor_view,
content::WebContents* web_contents,
const commerce::DiscountInfo& discount_info)
: … { … }
DiscountsBubbleDialogView::~DiscountsBubbleDialogView() = default;
void DiscountsBubbleDialogView::AddedToWidget() { … }
std::unique_ptr<views::View>
DiscountsBubbleDialogView::CreateMainPageHeaderView() { … }
std::unique_ptr<views::View> DiscountsBubbleDialogView::CreateMainPageTitleView(
const commerce::DiscountInfo& discount_info) { … }
std::unique_ptr<views::View> DiscountsBubbleDialogView::CreateMainPageContent(
const commerce::DiscountInfo& discount_info,
const std::string& seller_domain) { … }
void DiscountsBubbleDialogView::OpenMainPage(
commerce::DiscountInfo discount_info,
std::string seller_domain) { … }
void DiscountsBubbleDialogView::OpenTermsAndConditionsPage(
commerce::DiscountInfo discount_info,
std::string seller_domain) { … }
void DiscountsBubbleDialogView::CopyButtonClicked() { … }
void DiscountsBubbleDialogView::OnDialogClosing() { … }
BEGIN_METADATA(…)
DiscountsBubbleCoordinator::DiscountsBubbleCoordinator(views::View* anchor_view)
: … { … }
DiscountsBubbleCoordinator::~DiscountsBubbleCoordinator() = default;
void DiscountsBubbleCoordinator::OnWidgetDestroying(views::Widget* widget) { … }
void DiscountsBubbleCoordinator::Show(
content::WebContents* web_contents,
const commerce::DiscountInfo& discount_info,
base::OnceClosure on_dialog_closing_callback) { … }
void DiscountsBubbleCoordinator::Hide() { … }
DiscountsBubbleDialogView* DiscountsBubbleCoordinator::GetBubble() const { … }
bool DiscountsBubbleCoordinator::IsShowing() { … }