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_helpers.h" | 5 #include "chrome/service/cloud_print/cloud_print_helpers.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/common/cloud_print/cloud_print_constants.h" | 8 #include "chrome/common/cloud_print/cloud_print_constants.h" |
9 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 9 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
10 #include "chrome/service/cloud_print/cloud_print_token_store.h" | 10 #include "chrome/service/cloud_print/cloud_print_token_store.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 } | 45 } |
46 | 46 |
47 GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, | 47 GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, |
48 const std::string& job_id, | 48 const std::string& job_id, |
49 const PrintJobDetails& details) { | 49 const PrintJobDetails& details) { |
50 std::string status_string = StringFromJobStatus(details.status); | 50 std::string status_string = StringFromJobStatus(details.status); |
51 std::string path(AppendPathToUrl(cloud_print_server_url, "control")); | 51 std::string path(AppendPathToUrl(cloud_print_server_url, "control")); |
52 GURL::Replacements replacements; | 52 GURL::Replacements replacements; |
53 replacements.SetPathStr(path); | 53 replacements.SetPathStr(path); |
54 std::string query = | 54 std::string query = |
55 StringPrintf("jobid=%s&status=%s&code=%d&message=%s" | 55 base::StringPrintf("jobid=%s&status=%s&code=%d&message=%s" |
56 "&numpages=%d&pagesprinted=%d", | 56 "&numpages=%d&pagesprinted=%d", |
57 job_id.c_str(), | 57 job_id.c_str(), |
58 status_string.c_str(), | 58 status_string.c_str(), |
59 details.platform_status_flags, | 59 details.platform_status_flags, |
60 details.status_message.c_str(), | 60 details.status_message.c_str(), |
61 details.total_pages, | 61 details.total_pages, |
62 details.pages_printed); | 62 details.pages_printed); |
63 replacements.SetQueryStr(query); | 63 replacements.SetQueryStr(query); |
64 return cloud_print_server_url.ReplaceComponents(replacements); | 64 return cloud_print_server_url.ReplaceComponents(replacements); |
65 } | 65 } |
66 | 66 |
67 std::string GetHashOfPrinterInfo( | 67 std::string GetHashOfPrinterInfo( |
68 const printing::PrinterBasicInfo& printer_info) { | 68 const printing::PrinterBasicInfo& printer_info) { |
69 return GetHashOfPrinterTags(printer_info.options); | 69 return GetHashOfPrinterTags(printer_info.options); |
70 } | 70 } |
71 | 71 |
72 std::string GetPostDataForPrinterInfo( | 72 std::string GetPostDataForPrinterInfo( |
(...skipping 16 matching lines...) Expand all Loading... |
89 if (!token_store || token_store->token().empty()) { | 89 if (!token_store || token_store->token().empty()) { |
90 // Using LOG here for critical errors. GCP connector may run in the headless | 90 // Using LOG here for critical errors. GCP connector may run in the headless |
91 // mode and error indication might be useful for user in that case. | 91 // mode and error indication might be useful for user in that case. |
92 LOG(ERROR) << "CP_PROXY: Missing OAuth token for request"; | 92 LOG(ERROR) << "CP_PROXY: Missing OAuth token for request"; |
93 return std::string(); | 93 return std::string(); |
94 } | 94 } |
95 return GetCloudPrintAuthHeader(token_store->token()); | 95 return GetCloudPrintAuthHeader(token_store->token()); |
96 } | 96 } |
97 | 97 |
98 } // namespace cloud_print | 98 } // namespace cloud_print |
OLD | NEW |