| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_helpers.h" | 5 #include "chrome/service/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/md5.h" | 8 #include "base/md5.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 details.platform_status_flags, | 132 details.platform_status_flags, |
| 133 details.status_message.c_str(), | 133 details.status_message.c_str(), |
| 134 details.total_pages, | 134 details.total_pages, |
| 135 details.pages_printed); | 135 details.pages_printed); |
| 136 replacements.SetQueryStr(query); | 136 replacements.SetQueryStr(query); |
| 137 return cloud_print_server_url.ReplaceComponents(replacements); | 137 return cloud_print_server_url.ReplaceComponents(replacements); |
| 138 } | 138 } |
| 139 | 139 |
| 140 GURL CloudPrintHelpers::GetUrlForUserMessage(const GURL& cloud_print_server_url, | 140 GURL CloudPrintHelpers::GetUrlForUserMessage(const GURL& cloud_print_server_url, |
| 141 const std::string& message_id) { | 141 const std::string& message_id) { |
| 142 std::string path(AppendPathToUrl(cloud_print_server_url, "user/message")); | 142 std::string path(AppendPathToUrl(cloud_print_server_url, "message")); |
| 143 GURL::Replacements replacements; | 143 GURL::Replacements replacements; |
| 144 replacements.SetPathStr(path); | 144 replacements.SetPathStr(path); |
| 145 std::string query = StringPrintf("code=%s", message_id.c_str()); | 145 std::string query = StringPrintf("code=%s", message_id.c_str()); |
| 146 replacements.SetQueryStr(query); | 146 replacements.SetQueryStr(query); |
| 147 return cloud_print_server_url.ReplaceComponents(replacements); | 147 return cloud_print_server_url.ReplaceComponents(replacements); |
| 148 } | 148 } |
| 149 | 149 |
| 150 GURL CloudPrintHelpers::GetUrlForGetAuthCode(const GURL& cloud_print_server_url, | 150 GURL CloudPrintHelpers::GetUrlForGetAuthCode(const GURL& cloud_print_server_url, |
| 151 const std::string& oauth_client_id, | 151 const std::string& oauth_client_id, |
| 152 const std::string& proxy_id) { | 152 const std::string& proxy_id) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 LOG(ERROR) << "CP_PROXY: Missing OAuth token for request"; | 277 LOG(ERROR) << "CP_PROXY: Missing OAuth token for request"; |
| 278 } | 278 } |
| 279 | 279 |
| 280 if (token_store) { | 280 if (token_store) { |
| 281 header = "Authorization: OAuth "; | 281 header = "Authorization: OAuth "; |
| 282 header += token_store->token(); | 282 header += token_store->token(); |
| 283 } | 283 } |
| 284 return header; | 284 return header; |
| 285 } | 285 } |
| 286 | 286 |
| OLD | NEW |