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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 // Update some printer description properties to better identify the extension | 520 // Update some printer description properties to better identify the extension |
521 // managing the printer. | 521 // managing the printer. |
522 for (size_t i = 0; i < result.size(); ++i) { | 522 for (size_t i = 0; i < result.size(); ++i) { |
523 scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); | 523 scoped_ptr<base::DictionaryValue> printer(result[i]->ToValue()); |
524 std::string internal_printer_id; | 524 std::string internal_printer_id; |
525 CHECK(printer->GetString("id", &internal_printer_id)); | 525 CHECK(printer->GetString("id", &internal_printer_id)); |
526 printer->SetString("id", | 526 printer->SetString("id", |
527 GeneratePrinterId(extension->id(), internal_printer_id)); | 527 GeneratePrinterId(extension->id(), internal_printer_id)); |
528 printer->SetString("extensionId", extension->id()); | 528 printer->SetString("extensionId", extension->id()); |
| 529 printer->SetString("extensionName", extension->name()); |
529 | 530 |
530 base::string16 printer_name; | 531 base::string16 printer_name; |
531 if (printer->GetString("name", &printer_name) && | 532 if (printer->GetString("name", &printer_name) && |
532 base::i18n::AdjustStringForLocaleDirection(&printer_name)) { | 533 base::i18n::AdjustStringForLocaleDirection(&printer_name)) { |
533 printer->SetString("name", printer_name); | 534 printer->SetString("name", printer_name); |
534 } | 535 } |
535 | 536 |
536 base::string16 printer_description; | 537 base::string16 printer_description; |
537 if (printer->GetString("description", &printer_description) && | 538 if (printer->GetString("description", &printer_description) && |
538 base::i18n::AdjustStringForLocaleDirection(&printer_description)) { | 539 base::i18n::AdjustStringForLocaleDirection(&printer_description)) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 return new PrinterProviderAPIImpl(context); | 611 return new PrinterProviderAPIImpl(context); |
611 } | 612 } |
612 | 613 |
613 // static | 614 // static |
614 std::string PrinterProviderAPI::GetDefaultPrintError() { | 615 std::string PrinterProviderAPI::GetDefaultPrintError() { |
615 return core_api::printer_provider_internal::ToString( | 616 return core_api::printer_provider_internal::ToString( |
616 core_api::printer_provider_internal::PRINT_ERROR_FAILED); | 617 core_api::printer_provider_internal::PRINT_ERROR_FAILED); |
617 } | 618 } |
618 | 619 |
619 } // namespace extensions | 620 } // namespace extensions |
OLD | NEW |