|
@@ -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
|