Commit 72eafe03 authored by rbpotter's avatar rbpotter Committed by Commit Bot

PrivetPrinterHandler: fix crash

Bug: 793335
Change-Id: I910d8c2100476372cd0004edde23ecde2bd4bd58
Reviewed-on: https://chromium-review.googlesource.com/887622Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532178}
parent 39c7f4dc
...@@ -100,15 +100,19 @@ void PrivetPrinterHandler::LocalPrinterChanged( ...@@ -100,15 +100,19 @@ void PrivetPrinterHandler::LocalPrinterChanged(
bool has_local_printing, bool has_local_printing,
const cloud_print::DeviceDescription& description) { const cloud_print::DeviceDescription& description) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (has_local_printing || if (!added_printers_callback_ ||
command_line->HasSwitch(switches::kEnablePrintPreviewRegisterPromos)) { (!has_local_printing &&
auto printer_info = std::make_unique<base::DictionaryValue>(); !command_line->HasSwitch(switches::kEnablePrintPreviewRegisterPromos))) {
FillPrinterDescription(name, description, has_local_printing, // If Print Preview is not expecting this printer (callback reset or no
printer_info.get()); // registration promos and not a local printer), return early.
base::ListValue printers; return;
printers.Set(0, std::move(printer_info));
added_printers_callback_.Run(printers);
} }
auto printer_info = std::make_unique<base::DictionaryValue>();
FillPrinterDescription(name, description, has_local_printing,
printer_info.get());
base::ListValue printers;
printers.Set(0, std::move(printer_info));
added_printers_callback_.Run(printers);
} }
void PrivetPrinterHandler::LocalPrinterRemoved(const std::string& name) {} void PrivetPrinterHandler::LocalPrinterRemoved(const std::string& name) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment