#include "chrome/browser/ui/views/web_apps/pwa_confirmation_bubble_view.h"
#include <string>
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/metrics/user_metrics_action.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_info_image_source.h"
#include "chrome/browser/ui/views/web_apps/web_app_views_utils.h"
#include "chrome/browser/ui/web_applications/web_app_dialogs.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_pref_guardrails.h"
#include "chrome/common/chrome_features.h"
#include "chrome/grit/generated_resources.h"
#include "components/feature_engagement/public/event_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/strings/grit/components_strings.h"
#include "components/webapps/browser/installable/ml_install_operation_tracker.h"
#include "content/public/common/content_features.h"
#include "third_party/blink/public/common/features.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/gfx/image/image_skia.h"
#include "ui/gfx/text_elider.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/label_button.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/interaction/element_tracker_views.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "components/metrics/structured/structured_events.h"
#include "components/metrics/structured/structured_metrics_client.h"
#endif
namespace {
PWAConfirmationBubbleView* g_bubble_ = …;
std::unique_ptr<views::ImageView> CreateIconView(
const web_app::WebAppInstallInfo& web_app_info) { … }
#if BUILDFLAG(IS_CHROMEOS)
namespace cros_events = metrics::structured::events::v2::cr_os_events;
int64_t ToLong(web_app::WebAppInstallStatus web_app_install_status) {
return static_cast<int64_t>(web_app_install_status);
}
#endif
}
DEFINE_CLASS_ELEMENT_IDENTIFIER_VALUE(PWAConfirmationBubbleView,
kInstallButton);
DEFINE_CLASS_CUSTOM_ELEMENT_EVENT_TYPE(PWAConfirmationBubbleView,
kInstalledPWAEventId);
bool PWAConfirmationBubbleView::IsShowing() { … }
PWAConfirmationBubbleView* PWAConfirmationBubbleView::GetBubble() { … }
PWAConfirmationBubbleView::PWAConfirmationBubbleView(
views::View* anchor_view,
base::WeakPtr<content::WebContents> web_contents,
PageActionIconView* pwa_install_icon_view,
std::unique_ptr<web_app::WebAppInstallInfo> web_app_info,
std::unique_ptr<webapps::MlInstallOperationTracker> install_tracker,
web_app::AppInstallationAcceptanceCallback callback,
web_app::PwaInProductHelpState iph_state,
PrefService* prefs,
feature_engagement::Tracker* tracker)
: … { … }
PWAConfirmationBubbleView::~PWAConfirmationBubbleView() = default;
void PWAConfirmationBubbleView::OnWidgetInitialized() { … }
bool PWAConfirmationBubbleView::OnCloseRequested(
views::Widget::ClosedReason close_reason) { … }
views::View* PWAConfirmationBubbleView::GetInitiallyFocusedView() { … }
void PWAConfirmationBubbleView::WindowClosing() { … }
bool PWAConfirmationBubbleView::Accept() { … }
void PWAConfirmationBubbleView::OnBeforeBubbleWidgetInit(
views::Widget::InitParams* params,
views::Widget* widget) const { … }
BEGIN_METADATA(…)