| 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/common/cloud_print/cloud_print_helpers.h" | 5 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/md5.h" | 9 #include "base/md5.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 *succeeded = false; | 198 *succeeded = false; |
| 199 return response_dict.Pass(); | 199 return response_dict.Pass(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 std::string GetMultipartMimeType(const std::string& mime_boundary) { | 202 std::string GetMultipartMimeType(const std::string& mime_boundary) { |
| 203 return std::string("multipart/form-data; boundary=") + mime_boundary; | 203 return std::string("multipart/form-data; boundary=") + mime_boundary; |
| 204 } | 204 } |
| 205 | 205 |
| 206 // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits). | 206 // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits). |
| 207 void CreateMimeBoundaryForUpload(std::string* out) { | 207 void CreateMimeBoundaryForUpload(std::string* out) { |
| 208 int r1 = base::RandInt(0, kint32max); | 208 /*int r1 = base::RandInt(0, kint32max); |
| 209 int r2 = base::RandInt(0, kint32max); | 209 int r2 = base::RandInt(0, kint32max); |
| 210 base::SStringPrintf(out, "---------------------------%08X%08X", r1, r2); | 210 base::SStringPrintf(out, "---------------------------%08X%08X", r1, r2);*/ |
| 211 } | 211 } |
| 212 | 212 |
| 213 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags) { | 213 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags) { |
| 214 return HashPrinterTags(PreparePrinterTags(printer_tags)); | 214 return HashPrinterTags(PreparePrinterTags(printer_tags)); |
| 215 } | 215 } |
| 216 | 216 |
| 217 std::string GetPostDataForPrinterTags( | 217 std::string GetPostDataForPrinterTags( |
| 218 const PrinterTags& printer_tags, | 218 const PrinterTags& printer_tags, |
| 219 const std::string& mime_boundary, | 219 const std::string& mime_boundary, |
| 220 const std::string& proxy_tag_prefix, | 220 const std::string& proxy_tag_prefix, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 241 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, | 241 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, |
| 242 mime_boundary, std::string(), &post_data); | 242 mime_boundary, std::string(), &post_data); |
| 243 return post_data; | 243 return post_data; |
| 244 } | 244 } |
| 245 | 245 |
| 246 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { | 246 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { |
| 247 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); | 247 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace cloud_print | 250 } // namespace cloud_print |
| OLD | NEW |