1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
// 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_ENTERPRISE_CONNECTORS_ANALYSIS_CONTENT_ANALYSIS_VIEWS_H_
#define CHROME_BROWSER_ENTERPRISE_CONNECTORS_ANALYSIS_CONTENT_ANALYSIS_VIEWS_H_
#include "base/memory/raw_ptr.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/color/color_id.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/throbber.h"
namespace enterprise_connectors {
// Common interface shared by other classes in this file to access information
// about their shared content analysis dialog.
class ContentAnalysisBaseView {
public:
class Delegate {
public:
// Returns the appropriate top image ID depending on the current state of
// the content analysis dialog.
virtual int GetTopImageId() const = 0;
// Returns the color to be used to render the content analysis dialog's side
// logo.
virtual ui::ColorId GetSideImageLogoColor() const = 0;
// Returns the side image's background circle color depending on the state
// of the content analysis dialog.
virtual ui::ColorId GetSideImageBackgroundColor() const = 0;
// Returns true if the dialog is showing a non-pending state representing
// the final result of the content analysis.
virtual bool is_result() const = 0;
// Returns the web contents the content analysis view is being shown for.
content::WebContents* web_contenst();
};
explicit ContentAnalysisBaseView(Delegate* delegate);
Delegate* delegate();
private:
raw_ptr<Delegate, DanglingUntriaged> delegate_;
};
// `views::ImageView` representing the image at the top of the content analysis
// dialog.
class ContentAnalysisTopImageView : public ContentAnalysisBaseView,
public views::ImageView {
METADATA_HEADER(ContentAnalysisTopImageView, views::ImageView)
public:
using ContentAnalysisBaseView::ContentAnalysisBaseView;
void Update();
protected:
void OnThemeChanged() override;
};
// `views::ImageView` representing the enterprise building logo shown on the
// left side of the content analysis dialog.
class ContentAnalysisSideIconImageView : public ContentAnalysisBaseView,
public views::ImageView {
METADATA_HEADER(ContentAnalysisSideIconImageView, views::ImageView)
public:
explicit ContentAnalysisSideIconImageView(Delegate* delegate);
void Update();
protected:
void OnThemeChanged() override;
};
// `views::Throbber` shown on the left of the content analysis dialog while the
// user is waiting for a verdict.
class ContentAnalysisSideIconSpinnerView : public ContentAnalysisBaseView,
public views::Throbber {
METADATA_HEADER(ContentAnalysisSideIconSpinnerView, views::Throbber)
public:
using ContentAnalysisBaseView::ContentAnalysisBaseView;
void Update();
protected:
void OnThemeChanged() override;
};
} // namespace enterprise_connectors
#endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_ANALYSIS_CONTENT_ANALYSIS_VIEWS_H_
|