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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/print_preview/printer_backend_proxy.h"
6
7 #include <memory>
8 #include <vector>
9
10 #include "base/values.h"
11 #include "chrome/browser/chromeos/printing/printer_pref_manager.h"
12 #include "chrome/browser/chromeos/printing/printer_pref_manager_factory.h"
13 #include "chrome/browser/profiles/profile.h"
14 #include "chromeos/printing/printer_configuration.h"
15 #include "content/public/browser/browser_thread.h"
16 #include "printing/backend/print_backend.h"
17
18 namespace printing {
19
20 std::string GetDefaultPrinterOnBlockingPoolThread() {
21 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
22 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.
23 }
24
25 PrinterList EnumeratePrintersOnBlockingPoolThread(Profile* profile) {
26 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
27
28 chromeos::PrinterPrefManager* prefs =
29 chromeos::PrinterPrefManagerFactory::GetForBrowserContext(profile);
30 std::vector<std::unique_ptr<chromeos::Printer>> printers =
31 prefs->GetPrinters();
32 PrinterList printer_list;
33 for (const std::unique_ptr<chromeos::Printer>& printer : printers) {
34 PrinterBasicInfo basic_info;
35 basic_info.printer_id = printer->id();
36 basic_info.printer_name = printer->display_name();
37 basic_info.printer_description = printer->display_name();
38 printer_list.push_back(std::move(basic_info));
39 }
40
41 return printer_list;
42 }
43
44 } // namespace printing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698