OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "extensions/browser/api/printer_provider/printer_provider_api.h" | 5 #include "extensions/browser/api/printer_provider/printer_provider_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 } | 660 } |
661 | 661 |
662 void PrinterProviderAPIImpl::OnGetPrintersResult( | 662 void PrinterProviderAPIImpl::OnGetPrintersResult( |
663 const Extension* extension, | 663 const Extension* extension, |
664 int request_id, | 664 int request_id, |
665 const PrinterProviderInternalAPIObserver::PrinterInfoVector& result) { | 665 const PrinterProviderInternalAPIObserver::PrinterInfoVector& result) { |
666 base::ListValue printer_list; | 666 base::ListValue printer_list; |
667 | 667 |
668 // Update some printer description properties to better identify the extension | 668 // Update some printer description properties to better identify the extension |
669 // managing the printer. | 669 // managing the printer. |
670 for (size_t i = 0; i < result.size(); ++i) { | 670 for (const api::printer_provider::PrinterInfo& p : result) { |
671 scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); | 671 scoped_ptr<base::DictionaryValue> printer(p.ToValue()); |
672 UpdatePrinterWithExtensionInfo(printer.get(), extension); | 672 UpdatePrinterWithExtensionInfo(printer.get(), extension); |
673 printer_list.Append(std::move(printer)); | 673 printer_list.Append(std::move(printer)); |
674 } | 674 } |
675 | 675 |
676 pending_get_printers_requests_.CompleteForExtension(extension->id(), | 676 pending_get_printers_requests_.CompleteForExtension(extension->id(), |
677 request_id, printer_list); | 677 request_id, printer_list); |
678 } | 678 } |
679 | 679 |
680 void PrinterProviderAPIImpl::OnGetCapabilityResult( | 680 void PrinterProviderAPIImpl::OnGetCapabilityResult( |
681 const Extension* extension, | 681 const Extension* extension, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 return new PrinterProviderAPIImpl(context); | 763 return new PrinterProviderAPIImpl(context); |
764 } | 764 } |
765 | 765 |
766 // static | 766 // static |
767 std::string PrinterProviderAPI::GetDefaultPrintError() { | 767 std::string PrinterProviderAPI::GetDefaultPrintError() { |
768 return api::printer_provider_internal::ToString( | 768 return api::printer_provider_internal::ToString( |
769 api::printer_provider_internal::PRINT_ERROR_FAILED); | 769 api::printer_provider_internal::PRINT_ERROR_FAILED); |
770 } | 770 } |
771 | 771 |
772 } // namespace extensions | 772 } // namespace extensions |
OLD | NEW |