Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/service/cloud_print/print_system.h" | 5 #include "chrome/service/cloud_print/print_system.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/json/json_writer.h" | |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/win/object_watcher.h" | 12 #include "base/win/object_watcher.h" |
| 12 #include "base/win/scoped_bstr.h" | 13 #include "base/win/scoped_bstr.h" |
| 13 #include "base/win/scoped_comptr.h" | 14 #include "base/win/scoped_comptr.h" |
| 14 #include "base/win/scoped_hdc.h" | 15 #include "base/win/scoped_hdc.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/cloud_print/cloud_print_cdd_conversion.h" | |
| 16 #include "chrome/common/cloud_print/cloud_print_constants.h" | 18 #include "chrome/common/cloud_print/cloud_print_constants.h" |
| 17 #include "chrome/common/crash_keys.h" | 19 #include "chrome/common/crash_keys.h" |
| 18 #include "chrome/service/cloud_print/cdd_conversion_win.h" | 20 #include "chrome/service/cloud_print/cdd_conversion_win.h" |
| 19 #include "chrome/service/service_process.h" | 21 #include "chrome/service/service_process.h" |
| 20 #include "chrome/service/service_utility_process_host.h" | 22 #include "chrome/service/service_utility_process_host.h" |
| 21 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 22 #include "printing/backend/win_helper.h" | 24 #include "printing/backend/win_helper.h" |
| 23 #include "printing/emf_win.h" | 25 #include "printing/emf_win.h" |
| 24 #include "printing/page_range.h" | 26 #include "printing/page_range.h" |
| 25 #include "printing/printing_utils.h" | 27 #include "printing/printing_utils.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 Release(); | 560 Release(); |
| 559 } | 561 } |
| 560 | 562 |
| 561 virtual void OnGetPrinterSemanticCapsAndDefaults( | 563 virtual void OnGetPrinterSemanticCapsAndDefaults( |
| 562 bool succeeded, | 564 bool succeeded, |
| 563 const std::string& printer_name, | 565 const std::string& printer_name, |
| 564 const printing::PrinterSemanticCapsAndDefaults& semantic_info) OVERRIDE { | 566 const printing::PrinterSemanticCapsAndDefaults& semantic_info) OVERRIDE { |
| 565 printing::PrinterCapsAndDefaults printer_info; | 567 printing::PrinterCapsAndDefaults printer_info; |
| 566 if (succeeded) { | 568 if (succeeded) { |
| 567 printer_info.caps_mime_type = kContentTypeJSON; | 569 printer_info.caps_mime_type = kContentTypeJSON; |
| 568 printer_info.printer_capabilities = CapabilitiesToCdd(semantic_info); | 570 scoped_ptr<base::DictionaryValue> description( |
| 571 PrinterSemanticCapsAndDefaultsToCdd(semantic_info)); | |
| 572 base::JSONWriter::WriteWithOptions( | |
|
Vitaly Buka (NO REVIEWS)
2014/06/04 00:05:46
empty string?
Aleksey Shlyapnikov
2014/06/04 02:02:47
Done.
| |
| 573 description.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, | |
| 574 &printer_info.printer_capabilities); | |
| 569 } | 575 } |
| 570 callback_.Run(succeeded, printer_name, printer_info); | 576 callback_.Run(succeeded, printer_name, printer_info); |
| 571 callback_.Reset(); | 577 callback_.Reset(); |
| 572 Release(); | 578 Release(); |
| 573 } | 579 } |
| 574 | 580 |
| 575 void StartGetPrinterCapsAndDefaults() { | 581 void StartGetPrinterCapsAndDefaults() { |
| 576 g_service_process->io_thread()->message_loop_proxy()->PostTask( | 582 g_service_process->io_thread()->message_loop_proxy()->PostTask( |
| 577 FROM_HERE, | 583 FROM_HERE, |
| 578 base::Bind(&PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, this, | 584 base::Bind(&PrinterCapsHandler::GetPrinterCapsAndDefaultsImpl, this, |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 } | 840 } |
| 835 | 841 |
| 836 } // namespace | 842 } // namespace |
| 837 | 843 |
| 838 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( | 844 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( |
| 839 const base::DictionaryValue* print_system_settings) { | 845 const base::DictionaryValue* print_system_settings) { |
| 840 return new PrintSystemWin; | 846 return new PrintSystemWin; |
| 841 } | 847 } |
| 842 | 848 |
| 843 } // namespace cloud_print | 849 } // namespace cloud_print |
| OLD | NEW |