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

Unified Diff: chrome/browser/ui/webui/print_preview/printer_backend_proxy.cc

Issue 2463473002: Present the printer list from preferences for Chrome OS. (Closed)
Patch Set: add bug id Created 4 years, 1 month 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
Index: chrome/browser/ui/webui/print_preview/printer_backend_proxy.cc
diff --git a/chrome/browser/ui/webui/print_preview/printer_backend_proxy.cc b/chrome/browser/ui/webui/print_preview/printer_backend_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..130fc486527f5a37b8724f6592f61e4f9d9a3eb1
--- /dev/null
+++ b/chrome/browser/ui/webui/print_preview/printer_backend_proxy.cc
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h"
+
+#include <string>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "content/public/browser/browser_thread.h"
+#include "printing/backend/print_backend.h"
+
+namespace printing {
+
+std::string GetDefaultPrinterOnBlockingPoolThread() {
+ DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
+
+ scoped_refptr<printing::PrintBackend> print_backend(
+ PrintBackend::CreateInstance(nullptr));
+
+ std::string default_printer = print_backend->GetDefaultPrinterName();
+ VLOG(1) << "Default Printer: " << default_printer;
+ return default_printer;
+}
+
+PrinterList EnumeratePrintersOnBlockingPoolThread(Profile* /* profile */) {
+ DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
+ PrinterList printer_list;
Lei Zhang 2016/11/03 07:39:50 nit: move this down to line 34, and make line 34 t
skau 2016/11/03 21:58:27 Done.
+
+ scoped_refptr<PrintBackend> print_backend(
+ PrintBackend::CreateInstance(nullptr));
+
+ print_backend->EnumeratePrinters(&printer_list);
+
+ return printer_list;
+}
+
+} // namespace printing

Powered by Google App Engine
This is Rietveld 408576698