Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3927)

Unified Diff: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc

Issue 2790603003: Make CUPS USB printing play better with the settings page. This change does several things: (Closed)
Patch Set: stop latching PrintersManager, add comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
diff --git a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
index a08eb77db9cbf63470e2a46ac159af2f57bbe0f8..8a8b009155a903623419459db0c7c24f9b3d7dd0 100644
--- a/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
+++ b/chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc
@@ -16,9 +16,9 @@
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/browser/chromeos/printing/fake_printer_discoverer.h"
#include "chrome/browser/chromeos/printing/ppd_provider_factory.h"
#include "chrome/browser/chromeos/printing/printer_configurer.h"
+#include "chrome/browser/chromeos/printing/printer_discoverer.h"
#include "chrome/browser/chromeos/printing/printers_manager_factory.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/profiles/profile.h"
@@ -378,23 +378,16 @@ void CupsPrintersHandler::FileSelected(const base::FilePath& path,
}
void CupsPrintersHandler::HandleStartDiscovery(const base::ListValue* args) {
- if (!printer_discoverer_.get())
- printer_discoverer_ = chromeos::PrinterDiscoverer::Create();
+ if (!printer_discoverer_.get()) {
+ printer_discoverer_ =
+ chromeos::PrinterDiscoverer::CreateForProfile(profile_);
+ }
printer_discoverer_->AddObserver(this);
- if (!printer_discoverer_->StartDiscovery()) {
- CallJavascriptFunction("cr.webUIListenerCallback",
- base::Value("on-printer-discovery-failed"));
- printer_discoverer_->RemoveObserver(this);
- }
}
void CupsPrintersHandler::HandleStopDiscovery(const base::ListValue* args) {
- if (printer_discoverer_.get()) {
- printer_discoverer_->RemoveObserver(this);
- printer_discoverer_->StopDiscovery();
- printer_discoverer_.reset();
- }
+ printer_discoverer_.reset();
}
void CupsPrintersHandler::OnPrintersFound(
@@ -402,16 +395,14 @@ void CupsPrintersHandler::OnPrintersFound(
std::unique_ptr<base::ListValue> printers_list =
base::MakeUnique<base::ListValue>();
for (const auto& printer : printers) {
- std::unique_ptr<base::DictionaryValue> printer_info =
- GetPrinterInfo(printer);
- printers_list->Append(std::move(printer_info));
+ printers_list->Append(GetPrinterInfo(printer));
}
CallJavascriptFunction("cr.webUIListenerCallback",
base::Value("on-printer-discovered"), *printers_list);
}
-void CupsPrintersHandler::OnDiscoveryDone() {
+void CupsPrintersHandler::OnDiscoveryInitialScanDone() {
CallJavascriptFunction("cr.webUIListenerCallback",
base::Value("on-printer-discovery-done"));
}
« no previous file with comments | « chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698