Chromium Code Reviews| Index: chrome/common/cloud_print/cloud_print_helpers.h |
| diff --git a/chrome/common/cloud_print/cloud_print_helpers.h b/chrome/common/cloud_print/cloud_print_helpers.h |
| index 1b4a15ee6011876a62081746119dc6ba864678e0..998357bd1f7cb283abd837ac01723c5fd2e298eb 100644 |
| --- a/chrome/common/cloud_print/cloud_print_helpers.h |
| +++ b/chrome/common/cloud_print/cloud_print_helpers.h |
| @@ -5,7 +5,9 @@ |
| #ifndef CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| #define CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| +#include <map> |
| #include <string> |
| +#include <vector> |
| class GURL; |
| @@ -16,11 +18,7 @@ class DictionaryValue; |
| // Helper consts and methods for both cloud print and chrome browser. |
| namespace cloud_print { |
| -// Values in the respone JSON from the cloud print server |
| -extern const char kPrinterListValue[]; |
| -extern const char kSuccessValue[]; |
| - |
| -extern const char kChromeCloudPrintProxyHeader[]; |
| +typedef std::map<std::string, std::string> PrinterTags; |
|
msw
2012/11/17 00:22:30
nit: comment on the significance of printer tags.
Chen Yu
2012/11/26 12:07:06
Done.
|
| // Appends a relative path to the url making sure to append a '/' if the |
| // URL's path does not end with a slash. It is assumed that |path| does not |
| @@ -32,6 +30,27 @@ std::string AppendPathToUrl(const GURL& url, const std::string& path); |
| GURL GetUrlForSearch(const GURL& cloud_print_server_url); |
| GURL GetUrlForSubmit(const GURL& cloud_print_server_url); |
| +GURL GetUrlForPrinterList(const GURL& cloud_print_server_url, |
| + const std::string& proxy_id); |
| +GURL GetUrlForPrinterRegistration(const GURL& cloud_print_server_url); |
| +GURL GetUrlForPrinterUpdate(const GURL& cloud_print_server_url, |
| + const std::string& printer_id); |
| +GURL GetUrlForPrinterDelete(const GURL& cloud_print_server_url, |
| + const std::string& printer_id, |
| + const std::string& reason); |
| +GURL GetUrlForJobFetch(const GURL& cloud_print_server_url, |
| + const std::string& printer_id, |
| + const std::string& reason); |
| +GURL GetUrlForJobDelete(const GURL& cloud_print_server_url, |
| + const std::string& job_id); |
| +GURL GetUrlForJobStatusUpdate(const GURL& cloud_print_server_url, |
| + const std::string& job_id, |
| + const std::string& status_string); |
| +GURL GetUrlForUserMessage(const GURL& cloud_print_server_url, |
| + const std::string& message_id); |
| +GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url, |
| + const std::string& oauth_client_id, |
| + const std::string& proxy_id); |
| // Parses the response data for any cloud print server request. The method |
| // returns false if there was an error in parsing the JSON. The succeeded |
| @@ -48,9 +67,31 @@ void AddMultipartValueForUpload(const std::string& value_name, |
| const std::string& content_type, |
| std::string* post_data); |
| +// Returns the mime type of multipart with |mime_boundary|. |
|
msw
2012/11/17 00:22:30
nit: MIME
Chen Yu
2012/11/26 12:07:06
Done.
|
| +std::string GetMultipartMimeType(const std::string& mime_boundary); |
| + |
| // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits). |
| void CreateMimeBoundaryForUpload(std::string *out); |
| +// Returns an MD5 hash for printer tags from |printer_tags| and the default tags |
|
msw
2012/11/17 00:22:30
nit: remove "printer tags from", |printer_tags| al
Chen Yu
2012/11/26 12:07:06
Done.
|
| +// required by cloud print server. |
| +std::string GetHashOfPrinterTags(const PrinterTags& printer_tags); |
| + |
| +// Returns an post data for printer tags from |printer_tags| and the default |
|
msw
2012/11/17 00:22:30
nit: s/an/the/ and perhaps just say "Get the post
Chen Yu
2012/11/26 12:07:06
Done.
|
| +// tags required by cloud print server. |
| +std::string GetPostDataForPrinterTags( |
| + const PrinterTags& printer_tags, |
| + const std::string& mime_boundary, |
| + const std::string& proxy_tag_prefix, |
| + const std::string& tags_hash_tag_name); |
| + |
| +// Returns true is tags indicate a dry run (test) job. |
|
msw
2012/11/17 00:22:30
nit: s/is/if/
Chen Yu
2012/11/26 12:07:06
Done.
|
| +bool IsDryRunJob(const std::vector<std::string>& tags, |
| + const std::string& tag_dry_run_flag); |
| + |
| +// Created CloudPrint auth header from the auth token. |
|
msw
2012/11/17 00:22:30
nit: "Get the cloud print auth header from |auth_t
Chen Yu
2012/11/26 12:07:06
Done.
|
| +std::string GetCloudPrintAuthHeader(const std::string& auth_token); |
| + |
| } // namespace cloud_print |
| #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |