| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |