electron/shell/browser/printing/print_view_manager_electron.h
electron-roller[bot] 061e2e5e73
chore: bump chromium to 113.0.5651.0 (main) (#37553)
* chore: bump chromium in DEPS to 113.0.5645.0

* chore: update patches/chromium/mas_avoid_usage_of_private_macos_apis.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4300129

Fix simple code shear

* chore: update patches/chromium/build_only_use_the_mas_build_config_in_the_required_components.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4297496

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4327491

patch-fuzz update; no manual changes

* chore: remove patches/chromium/fix_x11_window_restore_minimized_maximized_window.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4252946

Upstreamed by zcbenz, so local patch is no longer needed

* chore: update chromium/printing.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4313019

Remove cookie parameter from PrintViewManagerBase::UpdatePrintSettings()

* chore: remove NOTIMPLEMENTED BrowserProcessImpl::GetBreadcrumbPersistentStorageManager()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4247145

method removed upstream, so we do not need to add a stub for it in the subclass

* chore: remove PrintViewManagerElectron::UpdatePrintSettings()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/4313019

Previously, our implementation checked to see if we recognized the
cookie param that was passed in. If so, we reported a bad message.
Otherwise, we passed it up to the base class' UpdatePrintSettings().

CL4313019 removed the cookie param, so checking for a bad cookie
param is no longer necessary / no longer possible. Since the only
remaining task was to pass the work up to the base class, this commit
removes the subclass implmentation entirely.

* chore: update patches

* chore: bump chromium in DEPS to 113.0.5647.0

* chore: bump chromium in DEPS to 113.0.5649.2

* chore: bump chromium in DEPS to 113.0.5651.0

* chore: update patches

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
2023-03-15 18:20:32 +09:00

80 lines
3 KiB
C++

// Copyright 2020 Microsoft, Inc. All rights reserved.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_PRINTING_PRINT_VIEW_MANAGER_ELECTRON_H_
#define ELECTRON_SHELL_BROWSER_PRINTING_PRINT_VIEW_MANAGER_ELECTRON_H_
#include <memory>
#include <string>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted_memory.h"
#include "build/build_config.h"
#include "chrome/browser/printing/print_view_manager_base.h"
#include "components/printing/browser/print_to_pdf/pdf_print_job.h"
#include "components/printing/common/print.mojom.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "printing/print_settings.h"
namespace electron {
using PrintToPdfCallback = print_to_pdf::PdfPrintJob::PrintToPdfCallback;
class PrintViewManagerElectron
: public printing::PrintViewManagerBase,
public content::WebContentsUserData<PrintViewManagerElectron> {
public:
~PrintViewManagerElectron() override;
PrintViewManagerElectron(const PrintViewManagerElectron&) = delete;
PrintViewManagerElectron& operator=(const PrintViewManagerElectron&) = delete;
static void BindPrintManagerHost(
mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost>
receiver,
content::RenderFrameHost* rfh);
void DidPrintToPdf(int cookie,
PrintToPdfCallback callback,
print_to_pdf::PdfPrintResult result,
scoped_refptr<base::RefCountedMemory> memory);
void PrintToPdf(content::RenderFrameHost* rfh,
const std::string& page_ranges,
printing::mojom::PrintPagesParamsPtr print_page_params,
PrintToPdfCallback callback);
private:
friend class content::WebContentsUserData<PrintViewManagerElectron>;
explicit PrintViewManagerElectron(content::WebContents* web_contents);
// printing::mojom::PrintManagerHost:
void DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages) override;
void GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) override;
void ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr params,
ScriptedPrintCallback callback) override;
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void SetupScriptedPrintPreview(
SetupScriptedPrintPreviewCallback callback) override;
void ShowScriptedPrintPreview(bool source_is_modifiable) override;
void RequestPrintPreview(
printing::mojom::RequestPrintPreviewParamsPtr params) override;
void CheckForCancel(int32_t preview_ui_id,
int32_t request_id,
CheckForCancelCallback callback) override;
#endif
std::vector<int32_t> pdf_jobs_;
base::WeakPtrFactory<PrintViewManagerElectron> weak_factory_{this};
WEB_CONTENTS_USER_DATA_KEY_DECL();
};
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_PRINTING_PRINT_VIEW_MANAGER_ELECTRON_H_