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

Side by Side Diff: chrome/browser/ui/webui/print_preview/printer_capabilities.cc

Issue 2517063002: M56: Print Preview: Fix handling of printers without capabilities. (Closed)
Patch Set: 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
« no previous file with comments | « chrome/browser/resources/print_preview/data/destination_store.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/print_preview/printer_capabilities.h" 5 #include "chrome/browser/ui/webui/print_preview/printer_capabilities.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 const auto printer_name_description = 88 const auto printer_name_description =
89 GetPrinterNameAndDescription(basic_info); 89 GetPrinterNameAndDescription(basic_info);
90 const std::string& printer_name = printer_name_description.first; 90 const std::string& printer_name = printer_name_description.first;
91 const std::string& printer_description = printer_name_description.second; 91 const std::string& printer_description = printer_name_description.second;
92 92
93 auto printer_info = base::MakeUnique<base::DictionaryValue>(); 93 auto printer_info = base::MakeUnique<base::DictionaryValue>();
94 printer_info->SetString(kPrinterId, device_name); 94 printer_info->SetString(kPrinterId, device_name);
95 printer_info->SetString(kSettingPrinterName, printer_name); 95 printer_info->SetString(kSettingPrinterName, printer_name);
96 printer_info->SetString(kSettingPrinterDescription, printer_description); 96 printer_info->SetString(kSettingPrinterDescription, printer_description);
97 97
98 std::unique_ptr<base::DictionaryValue> capabilities = 98 auto capabilities = GetPrinterCapabilitiesOnBlockingPoolThread(device_name);
99 GetPrinterCapabilitiesOnBlockingPoolThread(device_name); 99 if (!capabilities)
100 if (capabilities) 100 capabilities = base::MakeUnique<base::DictionaryValue>();
101 printer_info->Set(kPrinterCapabilities, std::move(capabilities)); 101 printer_info->Set(kPrinterCapabilities, std::move(capabilities));
102 102
103 return printer_info; 103 return printer_info;
104 } 104 }
105 105
106 } // namespace printing 106 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/data/destination_store.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698