#include "chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.h"
#include <cstddef>
#include <memory>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "cc/paint/paint_flags.h"
#include "chrome/browser/enterprise/connectors/analysis/content_analysis_features.h"
#include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/strings/grit/components_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_types.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/link.h"
#include "ui/views/controls/textarea/textarea.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/box_layout_view.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/layout/table_layout_view.h"
#if defined(_WINDOWS_)
#include "base/win/windows_h_disallowed.h"
#endif
namespace enterprise_connectors {
namespace {
constexpr base::TimeDelta kResizeAnimationDuration = …;
constexpr int kSideImageSize = …;
constexpr int kLineHeight = …;
constexpr gfx::Insets kSideImageInsets(8);
constexpr int kMessageAndIconRowLeadingPadding = …;
constexpr int kMessageAndIconRowTrailingPadding = …;
constexpr int kSideIconBetweenChildSpacing = …;
constexpr int kPaddingBeforeBypassJustification = …;
constexpr size_t kMaxBypassJustificationLength = …;
base::TimeDelta minimum_pending_dialog_time_ = …;
base::TimeDelta success_dialog_timeout_ = …;
base::TimeDelta show_dialog_delay_ = …;
class CircleBackground : public views::Background { … };
ContentAnalysisDialog::TestObserver* observer_for_testing = …;
}
class DeepScanningBaseView { … };
class DeepScanningTopImageView : public DeepScanningBaseView,
public views::ImageView { … };
BEGIN_METADATA(…)
class DeepScanningSideIconImageView : public DeepScanningBaseView,
public views::ImageView { … };
BEGIN_METADATA(…)
class DeepScanningSideIconSpinnerView : public DeepScanningBaseView,
public views::Throbber { … };
BEGIN_METADATA(…)
base::TimeDelta ContentAnalysisDialog::GetMinimumPendingDialogTime() { … }
base::TimeDelta ContentAnalysisDialog::GetSuccessDialogTimeout() { … }
base::TimeDelta ContentAnalysisDialog::ShowDialogDelay() { … }
ContentAnalysisDialog::ContentAnalysisDialog(
std::unique_ptr<ContentAnalysisDelegateBase> delegate,
bool is_cloud,
content::WebContents* contents,
safe_browsing::DeepScanAccessPoint access_point,
int files_count,
FinalContentAnalysisResult final_result,
download::DownloadItem* download_item)
: … { … }
void ContentAnalysisDialog::ShowDialogNow() { … }
std::u16string ContentAnalysisDialog::GetWindowTitle() const { … }
void ContentAnalysisDialog::AcceptButtonCallback() { … }
void ContentAnalysisDialog::CancelButtonCallback() { … }
void ContentAnalysisDialog::LearnMoreLinkClickedCallback(
const ui::Event& event) { … }
void ContentAnalysisDialog::SuccessCallback() { … }
void ContentAnalysisDialog::ContentsChanged(
views::Textfield* sender,
const std::u16string& new_contents) { … }
bool ContentAnalysisDialog::ShouldShowCloseButton() const { … }
views::View* ContentAnalysisDialog::GetContentsView() { … }
views::Widget* ContentAnalysisDialog::GetWidget() { … }
const views::Widget* ContentAnalysisDialog::GetWidget() const { … }
ui::mojom::ModalType ContentAnalysisDialog::GetModalType() const { … }
void ContentAnalysisDialog::WebContentsDestroyed() { … }
void ContentAnalysisDialog::PrimaryPageChanged(content::Page& page) { … }
void ContentAnalysisDialog::ShowResult(FinalContentAnalysisResult result) { … }
ContentAnalysisDialog::~ContentAnalysisDialog() { … }
void ContentAnalysisDialog::UpdateStateFromFinalResult(
FinalContentAnalysisResult final_result) { … }
void ContentAnalysisDialog::UpdateViews() { … }
bool ContentAnalysisDialog::ShouldShowDialogNow() { … }
void ContentAnalysisDialog::UpdateDialog() { … }
void ContentAnalysisDialog::Resize(int height_to_add) { … }
void ContentAnalysisDialog::SetupButtons() { … }
std::u16string ContentAnalysisDialog::GetDialogMessage() const { … }
std::u16string ContentAnalysisDialog::GetCancelButtonText() const { … }
std::u16string ContentAnalysisDialog::GetBypassWarningButtonText() const { … }
std::unique_ptr<views::View> ContentAnalysisDialog::CreateSideIcon() { … }
ui::ColorId ContentAnalysisDialog::GetSideImageBackgroundColor() const { … }
int ContentAnalysisDialog::GetTopImageId(bool use_dark) const { … }
std::u16string ContentAnalysisDialog::GetPendingMessage() const { … }
std::u16string ContentAnalysisDialog::GetFailureMessage() const { … }
std::u16string ContentAnalysisDialog::GetWarningMessage() const { … }
std::u16string ContentAnalysisDialog::GetSuccessMessage() const { … }
std::u16string ContentAnalysisDialog::GetCustomMessage() const { … }
void ContentAnalysisDialog::AddLearnMoreLinkToDialog() { … }
void ContentAnalysisDialog::AddJustificationTextLabelToDialog() { … }
void ContentAnalysisDialog::AddJustificationTextAreaToDialog() { … }
void ContentAnalysisDialog::AddJustificationTextLengthToDialog() { … }
void ContentAnalysisDialog::AddLinksToDialogMessage() { … }
void ContentAnalysisDialog::UpdateDialogMessage(std::u16string new_message) { … }
bool ContentAnalysisDialog::ShouldUseDarkTopImage() const { … }
ui::ImageModel ContentAnalysisDialog::GetTopImage() const { … }
bool ContentAnalysisDialog::is_print_scan() const { … }
void ContentAnalysisDialog::CancelDialogAndDelete() { … }
ui::ColorId ContentAnalysisDialog::GetSideImageLogoColor() const { … }
void ContentAnalysisDialog::SetMinimumPendingDialogTimeForTesting(
base::TimeDelta delta) { … }
void ContentAnalysisDialog::SetSuccessDialogTimeoutForTesting(
base::TimeDelta delta) { … }
void ContentAnalysisDialog::SetShowDialogDelayForTesting(
base::TimeDelta delta) { … }
void ContentAnalysisDialog::SetObserverForTesting(TestObserver* observer) { … }
views::ImageView* ContentAnalysisDialog::GetTopImageForTesting() const { … }
views::Throbber* ContentAnalysisDialog::GetSideIconSpinnerForTesting() const { … }
views::StyledLabel* ContentAnalysisDialog::GetMessageForTesting() const { … }
views::Link* ContentAnalysisDialog::GetLearnMoreLinkForTesting() const { … }
views::Label* ContentAnalysisDialog::GetBypassJustificationLabelForTesting()
const { … }
views::Textarea*
ContentAnalysisDialog::GetBypassJustificationTextareaForTesting() const { … }
views::Label* ContentAnalysisDialog::GetJustificationTextLengthForTesting()
const { … }
void ContentAnalysisDialog::OnDownloadUpdated(
download::DownloadItem* download) { … }
void ContentAnalysisDialog::OnDownloadOpened(download::DownloadItem* download) { … }
void ContentAnalysisDialog::OnDownloadDestroyed(
download::DownloadItem* download) { … }
void ContentAnalysisDialog::CancelDialogWithoutCallback() { … }
}