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