Chromium Code Reviews| 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 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 5 #ifndef CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 6 #define CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 9 #include <string> | 8 #include <string> |
| 10 #include <vector> | 9 #include <vector> |
| 11 | 10 |
| 12 #include "chrome/service/cloud_print/print_system.h" | 11 #include "chrome/service/cloud_print/print_system.h" |
| 13 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 14 | 13 |
| 15 namespace base { | 14 namespace cloud_print { |
| 16 class DictionaryValue; | |
| 17 } | |
| 18 | 15 |
| 19 // Helper methods for the cloud print proxy code. | 16 // Helper methods for the cloud print proxy code. |
| 20 class CloudPrintHelpers { | 17 GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, |
| 21 public: | 18 const std::string& job_id, |
| 22 static GURL GetUrlForPrinterRegistration(const GURL& cloud_print_server_url); | 19 PrintJobStatus status); |
| 23 static GURL GetUrlForPrinterUpdate(const GURL& cloud_print_server_url, | |
| 24 const std::string& printer_id); | |
| 25 static GURL GetUrlForPrinterDelete(const GURL& cloud_print_server_url, | |
| 26 const std::string& printer_id, | |
| 27 const std::string& reason); | |
| 28 static GURL GetUrlForPrinterList(const GURL& cloud_print_server_url, | |
| 29 const std::string& proxy_id); | |
| 30 static GURL GetUrlForJobFetch(const GURL& cloud_print_server_url, | |
| 31 const std::string& printer_id, | |
| 32 const std::string& reason); | |
| 33 static GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, | |
| 34 const std::string& job_id, | |
| 35 cloud_print::PrintJobStatus status); | |
| 36 static GURL GetUrlForJobStatusUpdate( | |
| 37 const GURL& cloud_print_server_url, | |
| 38 const std::string& job_id, | |
| 39 const cloud_print::PrintJobDetails& details); | |
| 40 static GURL GetUrlForUserMessage(const GURL& cloud_print_server_url, | |
| 41 const std::string& message_id); | |
| 42 static GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url, | |
| 43 const std::string& oauth_client_id, | |
| 44 const std::string& proxy_id); | |
| 45 | 20 |
| 46 // Returns an MD5 hash for printer tags. | 21 GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, |
| 47 static std::string GetHashOfPrinterTags( | 22 const std::string& job_id, |
| 48 const printing::PrinterBasicInfo& printer); | 23 const PrintJobDetails& details); |
| 49 // Returns an post data for printer tags. | |
| 50 static std::string GetPostDataForPrinterTags( | |
| 51 const printing::PrinterBasicInfo& printer_info, | |
| 52 const std::string& mime_boundary); | |
| 53 | 24 |
| 54 // Returns true is tags indicate a dry run (test) job. | 25 // Returns an MD5 hash for printer tags in the given |printer_info|. |
| 55 static bool IsDryRunJob(const std::vector<std::string>& tags); | 26 std::string GetHashOfPrinterInfo( |
| 27 const printing::PrinterBasicInfo& printer_info); | |
| 56 | 28 |
| 57 // Created CloudPrint auth header from the auth token stored in the store. | 29 // Returns an post data for printer tags in the given |printer_info|. |
|
msw
2012/11/29 19:57:36
nit: remove 'an' or correct to 'any'.
Chen Yu
2012/11/30 17:35:46
Done.
| |
| 58 static std::string GetCloudPrintAuthHeaderFromStore(); | 30 std::string GetPostDataForPrinterInfo( |
| 59 // Created CloudPrint auth header from the auth token. | 31 const printing::PrinterBasicInfo& printer_info, |
| 60 static std::string GetCloudPrintAuthHeader(const std::string& auth_token); | 32 const std::string& mime_boundary); |
| 61 | 33 |
| 62 private: | 34 // Returns true is tags indicate a dry run (test) job. |
|
msw
2012/11/29 19:57:36
nit: s/is/if/
Chen Yu
2012/11/30 17:35:46
Done.
| |
| 63 CloudPrintHelpers() {} | 35 bool IsDryRunJob(const std::vector<std::string>& tags); |
| 64 }; | 36 |
| 37 // Created CloudPrint auth header from the auth token stored in the store. | |
|
msw
2012/11/29 19:57:36
nit: "cloud print"
Chen Yu
2012/11/30 17:35:46
Done.
| |
| 38 std::string GetCloudPrintAuthHeaderFromStore(); | |
| 39 | |
| 40 } // namespace cloud_print | |
| 65 | 41 |
| 66 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 42 #endif // CHROME_SERVICE_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| OLD | NEW |