mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
chore: remove deprecated webContents.getPrinters() (#39735)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
@@ -41,25 +41,6 @@ struct Converter<printing::PrinterBasicInfo> {
|
||||
namespace electron::api {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
printing::PrinterList GetPrinterList(v8::Isolate* isolate) {
|
||||
EmitWarning(node::Environment::GetCurrent(isolate),
|
||||
"Deprecation Warning: getPrinters() is deprecated. "
|
||||
"Use the asynchronous and non-blocking version, "
|
||||
"getPrintersAsync(), instead.",
|
||||
"electron");
|
||||
printing::PrinterList printers;
|
||||
auto print_backend = printing::PrintBackend::CreateInstance(
|
||||
g_browser_process->GetApplicationLocale());
|
||||
{
|
||||
ScopedAllowBlockingForElectron allow_blocking;
|
||||
printing::mojom::ResultCode code =
|
||||
print_backend->EnumeratePrinters(printers);
|
||||
if (code != printing::mojom::ResultCode::kSuccess)
|
||||
LOG(INFO) << "Failed to enumerate printers";
|
||||
}
|
||||
return printers;
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> GetPrinterListAsync(v8::Isolate* isolate) {
|
||||
gin_helper::Promise<printing::PrinterList> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
@@ -92,7 +73,6 @@ v8::Local<v8::Promise> GetPrinterListAsync(v8::Isolate* isolate) {
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
using electron::api::GetPrinterList;
|
||||
using electron::api::GetPrinterListAsync;
|
||||
#endif
|
||||
|
||||
@@ -103,7 +83,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
dict.SetMethod("getPrinterList", base::BindRepeating(&GetPrinterList));
|
||||
dict.SetMethod("getPrinterListAsync",
|
||||
base::BindRepeating(&GetPrinterListAsync));
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user