refactor: hide printing impl details in api::WebContents (#43917)

* refactor: move api::WebContents::OnGetDeviceNameToUse() into an anonymous namespace

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: move api::WebContents::OnPDFCreated() into an anonymous namespace

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: remove unused #include

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-09-24 10:11:56 +02:00 committed by GitHub
parent cdcfe49592
commit ae6d5c4661
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 39 additions and 49 deletions

View file

@ -45,10 +45,6 @@
#include "shell/common/gin_helper/pinnable.h"
#include "ui/base/models/image_model.h"
#if BUILDFLAG(ENABLE_PRINTING)
#include "shell/browser/printing/print_view_manager_electron.h"
#endif
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/common/mojom/view_type.mojom-forward.h"
@ -246,16 +242,9 @@ class WebContents final : public ExclusiveAccessContext,
void HandleNewRenderFrame(content::RenderFrameHost* render_frame_host);
#if BUILDFLAG(ENABLE_PRINTING)
void OnGetDeviceNameToUse(base::Value::Dict print_settings,
printing::CompletionCallback print_callback,
// <error, device_name>
std::pair<std::string, std::u16string> info);
void Print(gin::Arguments* args);
// Print current page as PDF.
v8::Local<v8::Promise> PrintToPDF(const base::Value& settings);
void OnPDFCreated(gin_helper::Promise<v8::Local<v8::Value>> promise,
print_to_pdf::PdfPrintResult print_result,
scoped_refptr<base::RefCountedMemory> data);
#endif
void SetNextChildWebPreferences(const gin_helper::Dictionary);