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/cloud_print_connector.h" | 5 #include "chrome/service/cloud_print/cloud_print_connector.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/md5.h" | 9 #include "base/md5.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 info.printer_description, mime_boundary, std::string(), &post_data); | 615 info.printer_description, mime_boundary, std::string(), &post_data); |
616 net::AddMultipartValueForUpload(kPrinterStatusValue, | 616 net::AddMultipartValueForUpload(kPrinterStatusValue, |
617 base::StringPrintf("%d", info.printer_status), | 617 base::StringPrintf("%d", info.printer_status), |
618 mime_boundary, std::string(), &post_data); | 618 mime_boundary, std::string(), &post_data); |
619 // Add local_settings with a current XMPP ping interval. | 619 // Add local_settings with a current XMPP ping interval. |
620 net::AddMultipartValueForUpload(kPrinterLocalSettingsValue, | 620 net::AddMultipartValueForUpload(kPrinterLocalSettingsValue, |
621 base::StringPrintf(kCreateLocalSettingsXmppPingFormat, | 621 base::StringPrintf(kCreateLocalSettingsXmppPingFormat, |
622 settings_.xmpp_ping_timeout_sec()), | 622 settings_.xmpp_ping_timeout_sec()), |
623 mime_boundary, std::string(), &post_data); | 623 mime_boundary, std::string(), &post_data); |
624 post_data += GetPostDataForPrinterInfo(info, mime_boundary); | 624 post_data += GetPostDataForPrinterInfo(info, mime_boundary); |
625 if (caps_and_defaults.caps_mime_type == kContentTypeCDD) { | 625 if (caps_and_defaults.caps_mime_type == kContentTypeJSON) { |
626 net::AddMultipartValueForUpload(kUseCDD, "true", mime_boundary, | 626 net::AddMultipartValueForUpload(kUseCDD, "true", mime_boundary, |
627 std::string(), &post_data); | 627 std::string(), &post_data); |
628 } | 628 } |
629 net::AddMultipartValueForUpload(kPrinterCapsValue, | 629 net::AddMultipartValueForUpload(kPrinterCapsValue, |
630 caps_and_defaults.printer_capabilities, mime_boundary, | 630 caps_and_defaults.printer_capabilities, mime_boundary, |
631 caps_and_defaults.caps_mime_type, &post_data); | 631 caps_and_defaults.caps_mime_type, &post_data); |
632 net::AddMultipartValueForUpload(kPrinterDefaultsValue, | 632 net::AddMultipartValueForUpload(kPrinterDefaultsValue, |
633 caps_and_defaults.printer_defaults, mime_boundary, | 633 caps_and_defaults.printer_defaults, mime_boundary, |
634 caps_and_defaults.defaults_mime_type, &post_data); | 634 caps_and_defaults.defaults_mime_type, &post_data); |
635 // Send a hash of the printer capabilities to the server. We will use this | 635 // Send a hash of the printer capabilities to the server. We will use this |
(...skipping 10 matching lines...) Expand all Loading... |
646 kCloudPrintAPIMaxRetryCount, mime_type, post_data, | 646 kCloudPrintAPIMaxRetryCount, mime_type, post_data, |
647 &CloudPrintConnector::HandleRegisterPrinterResponse); | 647 &CloudPrintConnector::HandleRegisterPrinterResponse); |
648 } | 648 } |
649 | 649 |
650 bool CloudPrintConnector::IsSamePrinter(const std::string& name1, | 650 bool CloudPrintConnector::IsSamePrinter(const std::string& name1, |
651 const std::string& name2) const { | 651 const std::string& name2) const { |
652 return (0 == base::strcasecmp(name1.c_str(), name2.c_str())); | 652 return (0 == base::strcasecmp(name1.c_str(), name2.c_str())); |
653 } | 653 } |
654 | 654 |
655 } // namespace cloud_print | 655 } // namespace cloud_print |
OLD | NEW |