chromium/chrome/browser/ui/views/policy/enterprise_startup_dialog_view.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/views/policy/enterprise_startup_dialog_view.h"

#include <string>
#include <utility>

#include "base/functional/bind.h"
#include "base/i18n/message_formatter.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/headless/headless_mode_util.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/theme_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.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/color/color_id.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/background.h"
#include "ui/views/border.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/controls/throbber.h"
#include "ui/views/layout/box_layout.h"

#if BUILDFLAG(IS_MAC)
#include "base/task/current_thread.h"
#include "chrome/browser/ui/views/policy/enterprise_startup_dialog_mac_util.h"
#endif

namespace policy {
namespace {

constexpr int kDialogContentHeight =;  // The height of dialog content area.
constexpr int kDialogContentWidth =;   // The width of dialog content area.
constexpr int kIconSize =;      // The size of throbber and error icon.
constexpr int kLineHeight =;    // The height of text line.
constexpr int kFontSizeDelta =;  // The font size of text.

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
constexpr int kLogoHeight = 20;  // The height of Chrome enterprise logo.
#endif

gfx::Insets GetDialogInsets() {}

std::unique_ptr<views::Label> CreateText(const std::u16string& message) {}

#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
class LogoView : public views::ImageView {
  METADATA_HEADER(LogoView, views::ImageView)

 public:
  LogoView() {
    SetTooltipText(
        l10n_util::GetStringUTF16(IDS_PRODUCT_LOGO_ENTERPRISE_ALT_TEXT));
    SetVerticalAlignment(views::ImageView::Alignment::kCenter);
  }

  void OnThemeChanged() override {
    ImageView::OnThemeChanged();
    SetImage(ui::ResourceBundle::GetSharedInstance()
                 .GetImageNamed((GetNativeTheme()->ShouldUseDarkColors())
                                    ? IDR_PRODUCT_LOGO_ENTERPRISE_WHITE
                                    : IDR_PRODUCT_LOGO_ENTERPRISE)
                 .AsImageSkia());
    const gfx::Rect logo_bounds = GetImageBounds();
    SetImageSize(gfx::Size(
        logo_bounds.width() * kLogoHeight / logo_bounds.height(), kLogoHeight));
  }
};

BEGIN_METADATA(LogoView)
END_METADATA
#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING)

// Alternate implementation of the EnterpriseStartupDialog which is used when
// the headless mode is in effect. It does not display anything and when error
// is set immediately calls back with not accepted condition.
class HeadlessEnterpriseStartupDialogImpl : public EnterpriseStartupDialog {};

}  // namespace

EnterpriseStartupDialogView::EnterpriseStartupDialogView(
    EnterpriseStartupDialog::DialogResultCallback callback)
    :{}

EnterpriseStartupDialogView::~EnterpriseStartupDialogView() {}

void EnterpriseStartupDialogView::DisplayLaunchingInformationWithThrobber(
    const std::u16string& information) {}

void EnterpriseStartupDialogView::DisplayErrorMessage(
    const std::u16string& error_message,
    const std::optional<std::u16string>& accept_button) {}

void EnterpriseStartupDialogView::CloseDialog() {}

void EnterpriseStartupDialogView::AddWidgetObserver(
    views::WidgetObserver* observer) {}
void EnterpriseStartupDialogView::RemoveWidgetObserver(
    views::WidgetObserver* observer) {}

void EnterpriseStartupDialogView::StartModalDialog() {}

void EnterpriseStartupDialogView::RunDialogCallback(bool was_accepted) {}

bool EnterpriseStartupDialogView::ShouldShowWindowTitle() const {}

gfx::Size EnterpriseStartupDialogView::CalculatePreferredSize(
    const views::SizeBounds& available_size) const {}

void EnterpriseStartupDialogView::ResetDialog(bool show_accept_button) {}

void EnterpriseStartupDialogView::AddContent(
    std::unique_ptr<views::View> icon,
    std::unique_ptr<views::View> text) {}

BEGIN_METADATA()

/*
 * EnterpriseStartupDialogImpl
 */

EnterpriseStartupDialogImpl::EnterpriseStartupDialogImpl(
    DialogResultCallback callback) {}

EnterpriseStartupDialogImpl::~EnterpriseStartupDialogImpl() {}

void EnterpriseStartupDialogImpl::DisplayLaunchingInformationWithThrobber(
    const std::u16string& information) {}

void EnterpriseStartupDialogImpl::DisplayErrorMessage(
    const std::u16string& error_message,
    const std::optional<std::u16string>& accept_button) {}

bool EnterpriseStartupDialogImpl::IsShowing() {}

// views::WidgetObserver:
void EnterpriseStartupDialogImpl::OnWidgetDestroying(views::Widget* widget) {}

/*
 * EnterpriseStartupDialog
 */

// static
std::unique_ptr<EnterpriseStartupDialog>
EnterpriseStartupDialog::CreateAndShowDialog(DialogResultCallback callback) {}

}  // namespace policy