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

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

Issue 2463473002: Present the printer list from preferences for Chrome OS. (Closed)
Patch Set: tidy Created 4 years, 2 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
Index: chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc
diff --git a/chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc b/chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ecd280a50386a0b8ca2a96fbff54f37b731e8ee8
--- /dev/null
+++ b/chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc
@@ -0,0 +1,44 @@
+// 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 <memory>
+#include <vector>
+
+#include "base/values.h"
+#include "chrome/browser/chromeos/printing/printer_pref_manager.h"
+#include "chrome/browser/chromeos/printing/printer_pref_manager_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chromeos/printing/printer_configuration.h"
+#include "content/public/browser/browser_thread.h"
+#include "printing/backend/print_backend.h"
+
+namespace printing {
+
+std::string GetDefaultPrinterOnBlockingPoolThread() {
+ DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
+ return "";
Lei Zhang 2016/10/28 21:55:51 Is this intentional or will it be filled in with s
skau 2016/11/02 22:00:03 We don't have default printers in Chrome OS right
Lei Zhang 2016/11/02 22:40:59 If there is a bug # for that, please include it fo
skau 2016/11/02 23:38:16 Done.
+}
+
+PrinterList EnumeratePrintersOnBlockingPoolThread(Profile* profile) {
+ DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
+
+ chromeos::PrinterPrefManager* prefs =
+ chromeos::PrinterPrefManagerFactory::GetForBrowserContext(profile);
+ std::vector<std::unique_ptr<chromeos::Printer>> printers =
+ prefs->GetPrinters();
+ PrinterList printer_list;
+ for (const std::unique_ptr<chromeos::Printer>& printer : printers) {
+ PrinterBasicInfo basic_info;
+ basic_info.printer_id = printer->id();
+ basic_info.printer_name = printer->display_name();
+ basic_info.printer_description = printer->display_name();
+ printer_list.push_back(std::move(basic_info));
+ }
+
+ return printer_list;
+}
+
+} // namespace printing

Powered by Google App Engine
This is Rietveld 408576698