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