chromium/chrome/browser/printing/print_preview_dialog_controller.cc

// Copyright 2012 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/printing/print_preview_dialog_controller.h"

#include <algorithm>
#include <memory>
#include <string>
#include <vector>

#include "base/auto_reset.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/memory/weak_ptr.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/printing/print_view_manager_base.h"
#include "chrome/browser/task_manager/web_contents_tags.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/guest_view/browser/guest_view_base.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/url_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/web_dialogs/web_dialog_delegate.h"

#if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "chrome/browser/win/conflicts/module_database.h"
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/arc/print_spooler/print_session_impl.h"
#endif

NavigationController;
NavigationHandle;
WebContents;
WebUIMessageHandler;

namespace printing {

namespace {

PrintPreviewUI* GetPrintPreviewUIForDialog(WebContents* dialog) {}

#if BUILDFLAG(IS_CHROMEOS_ASH)
void CloseArcPrintSession(WebContents* initiator) {
  WebContents* outermost_web_contents =
      guest_view::GuestViewBase::GetTopLevelWebContents(initiator);
  auto* arc_print_session =
      arc::PrintSessionImpl::FromWebContents(outermost_web_contents);
  if (arc_print_session)
    arc_print_session->OnPrintPreviewClosed();
}
#endif

// A ui::WebDialogDelegate that specifies the print preview dialog appearance.
class PrintPreviewDialogDelegate : public ui::WebDialogDelegate {};

PrintPreviewDialogDelegate::PrintPreviewDialogDelegate(WebContents* initiator)
    :{}

PrintPreviewDialogDelegate::~PrintPreviewDialogDelegate() = default;

ui::mojom::ModalType PrintPreviewDialogDelegate::GetDialogModalType() const {}

std::u16string PrintPreviewDialogDelegate::GetDialogTitle() const {}

std::u16string PrintPreviewDialogDelegate::GetAccessibleDialogTitle() const {}

GURL PrintPreviewDialogDelegate::GetDialogContentURL() const {}

void PrintPreviewDialogDelegate::GetDialogSize(gfx::Size* size) const {}

std::string PrintPreviewDialogDelegate::GetDialogArgs() const {}

void PrintPreviewDialogDelegate::OnDialogClosingFromKeyEvent() {}

void PrintPreviewDialogDelegate::OnDialogClosed(
    const std::string& /* json_retval */) {}

void PrintPreviewDialogDelegate::OnCloseContents(WebContents* /* source */,
                                                 bool* out_close_dialog) {}

bool PrintPreviewDialogDelegate::ShouldShowDialogTitle() const {}

}  // namespace

// PrintPreviewDialogController ------------------------------------------------

PrintPreviewDialogController::PrintPreviewDialogController()
    :{}

// static
PrintPreviewDialogController* PrintPreviewDialogController::GetInstance() {}

void PrintPreviewDialogController::PrintPreview(
    WebContents* initiator,
    const mojom::RequestPrintPreviewParams& params) {}

// static
std::unique_ptr<ui::WebDialogDelegate>
PrintPreviewDialogController::CreatePrintPreviewDialogDelegateForTesting(
    WebContents* initiator) {}

WebContents* PrintPreviewDialogController::GetOrCreatePreviewDialogForTesting(
    WebContents* initiator) {}

WebContents* PrintPreviewDialogController::GetOrCreatePreviewDialog(
    WebContents* initiator,
    const mojom::RequestPrintPreviewParams& params) {}

WebContents* PrintPreviewDialogController::GetPrintPreviewForContents(
    WebContents* contents) const {}

WebContents* PrintPreviewDialogController::GetInitiator(
    WebContents* preview_dialog) {}

const mojom::RequestPrintPreviewParams*
PrintPreviewDialogController::GetRequestParams(
    content::WebContents* preview_dialog) const {}

void PrintPreviewDialogController::ForEachPreviewDialog(
    base::RepeatingCallback<void(content::WebContents*)> callback) {}

// static
bool PrintPreviewDialogController::IsPrintPreviewURL(const GURL& url) {}

// static
bool PrintPreviewDialogController::IsPrintPreviewContentURL(const GURL& url) {}

void PrintPreviewDialogController::EraseInitiatorInfo(
    WebContents* preview_dialog) {}

PrintPreviewDialogController::~PrintPreviewDialogController() = default;

void PrintPreviewDialogController::RenderProcessGone(
    content::WebContents* web_contents,
    base::TerminationStatus status) {}

void PrintPreviewDialogController::WebContentsDestroyed(WebContents* contents) {}

void PrintPreviewDialogController::DidFinishNavigation(
    WebContents* contents,
    NavigationHandle* navigation_handle) {}

void PrintPreviewDialogController::OnInitiatorNavigated(
    WebContents* initiator,
    NavigationHandle* navigation_handle) {}

void PrintPreviewDialogController::OnPreviewDialogNavigated(
    WebContents* preview_dialog,
    NavigationHandle* navigation_handle) {}

WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
    WebContents* initiator,
    const mojom::RequestPrintPreviewParams& params) {}

void PrintPreviewDialogController::SaveInitiatorTitle(
    WebContents* preview_dialog) {}

void PrintPreviewDialogController::RemoveInitiator(
    WebContents* initiator) {}

void PrintPreviewDialogController::RemovePreviewDialog(
    WebContents* preview_dialog) {}

}  // namespace printing