| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const std::string& reason) { | 116 const std::string& reason) { |
| 117 std::string path(AppendPathToUrl(cloud_print_server_url, "fetch")); | 117 std::string path(AppendPathToUrl(cloud_print_server_url, "fetch")); |
| 118 GURL::Replacements replacements; | 118 GURL::Replacements replacements; |
| 119 replacements.SetPathStr(path); | 119 replacements.SetPathStr(path); |
| 120 std::string query = base::StringPrintf( | 120 std::string query = base::StringPrintf( |
| 121 "printerid=%s&deb=%s", printer_id.c_str(), reason.c_str()); | 121 "printerid=%s&deb=%s", printer_id.c_str(), reason.c_str()); |
| 122 replacements.SetQueryStr(query); | 122 replacements.SetQueryStr(query); |
| 123 return cloud_print_server_url.ReplaceComponents(replacements); | 123 return cloud_print_server_url.ReplaceComponents(replacements); |
| 124 } | 124 } |
| 125 | 125 |
| 126 GURL GetUrlForJobCjt(const GURL& cloud_print_server_url, |
| 127 const std::string& job_id, |
| 128 const std::string& reason) { |
| 129 std::string path(AppendPathToUrl(cloud_print_server_url, "ticket")); |
| 130 GURL::Replacements replacements; |
| 131 replacements.SetPathStr(path); |
| 132 std::string query = base::StringPrintf( |
| 133 "jobid=%s&deb=%s&use_cjt=true", job_id.c_str(), reason.c_str()); |
| 134 replacements.SetQueryStr(query); |
| 135 return cloud_print_server_url.ReplaceComponents(replacements); |
| 136 } |
| 126 | 137 |
| 127 GURL GetUrlForJobDelete(const GURL& cloud_print_server_url, | 138 GURL GetUrlForJobDelete(const GURL& cloud_print_server_url, |
| 128 const std::string& job_id) { | 139 const std::string& job_id) { |
| 129 std::string path(AppendPathToUrl(cloud_print_server_url, "deletejob")); | 140 std::string path(AppendPathToUrl(cloud_print_server_url, "deletejob")); |
| 130 GURL::Replacements replacements; | 141 GURL::Replacements replacements; |
| 131 replacements.SetPathStr(path); | 142 replacements.SetPathStr(path); |
| 132 std::string query = base::StringPrintf("jobid=%s", job_id.c_str()); | 143 std::string query = base::StringPrintf("jobid=%s", job_id.c_str()); |
| 133 replacements.SetQueryStr(query); | 144 replacements.SetQueryStr(query); |
| 134 return cloud_print_server_url.ReplaceComponents(replacements); | 145 return cloud_print_server_url.ReplaceComponents(replacements); |
| 135 } | 146 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, | 244 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, |
| 234 mime_boundary, std::string(), &post_data); | 245 mime_boundary, std::string(), &post_data); |
| 235 return post_data; | 246 return post_data; |
| 236 } | 247 } |
| 237 | 248 |
| 238 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { | 249 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { |
| 239 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); | 250 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); |
| 240 } | 251 } |
| 241 | 252 |
| 242 } // namespace cloud_print | 253 } // namespace cloud_print |
| OLD | NEW |