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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 // Update some printer description properties to better identify the extension | 518 // Update some printer description properties to better identify the extension |
519 // managing the printer. | 519 // managing the printer. |
520 for (size_t i = 0; i < result.size(); ++i) { | 520 for (size_t i = 0; i < result.size(); ++i) { |
521 scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); | 521 scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); |
522 std::string internal_printer_id; | 522 std::string internal_printer_id; |
523 CHECK(printer->GetString("id", &internal_printer_id)); | 523 CHECK(printer->GetString("id", &internal_printer_id)); |
524 printer->SetString("id", | 524 printer->SetString("id", |
525 GeneratePrinterId(extension->id(), internal_printer_id)); | 525 GeneratePrinterId(extension->id(), internal_printer_id)); |
526 printer->SetString("extensionId", extension->id()); | 526 printer->SetString("extensionId", extension->id()); |
| 527 printer->SetString("extensionName", extension->name()); |
527 printer_list.Append(printer.release()); | 528 printer_list.Append(printer.release()); |
528 } | 529 } |
529 | 530 |
530 pending_get_printers_requests_.CompleteForExtension(extension->id(), | 531 pending_get_printers_requests_.CompleteForExtension(extension->id(), |
531 request_id, printer_list); | 532 request_id, printer_list); |
532 } | 533 } |
533 | 534 |
534 void PrinterProviderAPIImpl::OnGetCapabilityResult( | 535 void PrinterProviderAPIImpl::OnGetCapabilityResult( |
535 const Extension* extension, | 536 const Extension* extension, |
536 int request_id, | 537 int request_id, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 return new PrinterProviderAPIImpl(context); | 596 return new PrinterProviderAPIImpl(context); |
596 } | 597 } |
597 | 598 |
598 // static | 599 // static |
599 std::string PrinterProviderAPI::GetDefaultPrintError() { | 600 std::string PrinterProviderAPI::GetDefaultPrintError() { |
600 return core_api::printer_provider_internal::ToString( | 601 return core_api::printer_provider_internal::ToString( |
601 core_api::printer_provider_internal::PRINT_ERROR_FAILED); | 602 core_api::printer_provider_internal::PRINT_ERROR_FAILED); |
602 } | 603 } |
603 | 604 |
604 } // namespace extensions | 605 } // namespace extensions |
OLD | NEW |