| 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/printer_job_handler.h" | 5 #include "chrome/service/cloud_print/printer_job_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 676 |
| 677 void PrinterJobHandler::OnReceivePrinterCaps( | 677 void PrinterJobHandler::OnReceivePrinterCaps( |
| 678 bool succeeded, | 678 bool succeeded, |
| 679 const std::string& printer_name, | 679 const std::string& printer_name, |
| 680 const printing::PrinterCapsAndDefaults& caps_and_defaults) { | 680 const printing::PrinterCapsAndDefaults& caps_and_defaults) { |
| 681 printing::PrinterBasicInfo printer_info; | 681 printing::PrinterBasicInfo printer_info; |
| 682 if (printer_watcher_.get()) | 682 if (printer_watcher_.get()) |
| 683 printer_watcher_->GetCurrentPrinterInfo(&printer_info); | 683 printer_watcher_->GetCurrentPrinterInfo(&printer_info); |
| 684 | 684 |
| 685 std::string post_data; | 685 std::string post_data; |
| 686 std::string mime_boundary; | 686 std::string mime_boundary = net::GenerateMimeMultipartBoundary(); |
| 687 CreateMimeBoundaryForUpload(&mime_boundary); | |
| 688 | 687 |
| 689 if (succeeded) { | 688 if (succeeded) { |
| 690 std::string caps_hash = | 689 std::string caps_hash = |
| 691 base::MD5String(caps_and_defaults.printer_capabilities); | 690 base::MD5String(caps_and_defaults.printer_capabilities); |
| 692 if (caps_hash != printer_info_cloud_.caps_hash) { | 691 if (caps_hash != printer_info_cloud_.caps_hash) { |
| 693 // Hashes don't match, we need to upload new capabilities (the defaults | 692 // Hashes don't match, we need to upload new capabilities (the defaults |
| 694 // go for free along with the capabilities) | 693 // go for free along with the capabilities) |
| 695 printer_info_cloud_.caps_hash = caps_hash; | 694 printer_info_cloud_.caps_hash = caps_hash; |
| 696 if (caps_and_defaults.caps_mime_type == kContentTypeJSON) { | 695 if (caps_and_defaults.caps_mime_type == kContentTypeJSON) { |
| 697 DCHECK(print_system_->UseCddAndCjt()); | 696 DCHECK(print_system_->UseCddAndCjt()); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 job_details.print_data_mime_type_, | 809 job_details.print_data_mime_type_, |
| 811 printer_name, | 810 printer_name, |
| 812 base::UTF16ToUTF8(document_name), | 811 base::UTF16ToUTF8(document_name), |
| 813 job_details.tags_, | 812 job_details.tags_, |
| 814 this)) { | 813 this)) { |
| 815 OnJobSpoolFailed(); | 814 OnJobSpoolFailed(); |
| 816 } | 815 } |
| 817 } | 816 } |
| 818 | 817 |
| 819 } // namespace cloud_print | 818 } // namespace cloud_print |
| OLD | NEW |