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_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 5 #ifndef CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
6 #define CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 6 #define CHROME_COMMON_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> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const std::string& proxy_id); | 56 const std::string& proxy_id); |
57 | 57 |
58 // Parses the response data for any cloud print server request. The method | 58 // Parses the response data for any cloud print server request. The method |
59 // returns null if there was an error in parsing the JSON. The succeeded | 59 // returns null if there was an error in parsing the JSON. The succeeded |
60 // value returns the value of the "success" value in the response JSON. | 60 // value returns the value of the "success" value in the response JSON. |
61 // Returns the response as a dictionary value. | 61 // Returns the response as a dictionary value. |
62 scoped_ptr<base::DictionaryValue> ParseResponseJSON( | 62 scoped_ptr<base::DictionaryValue> ParseResponseJSON( |
63 const std::string& response_data, | 63 const std::string& response_data, |
64 bool* succeeded); | 64 bool* succeeded); |
65 | 65 |
66 // Prepares one value as part of a multi-part upload request. | |
67 void AddMultipartValueForUpload(const std::string& value_name, | |
68 const std::string& value, | |
69 const std::string& mime_boundary, | |
70 const std::string& content_type, | |
71 std::string* post_data); | |
72 | |
73 // Returns the MIME type of multipart with |mime_boundary|. | 66 // Returns the MIME type of multipart with |mime_boundary|. |
74 std::string GetMultipartMimeType(const std::string& mime_boundary); | 67 std::string GetMultipartMimeType(const std::string& mime_boundary); |
75 | 68 |
76 // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits). | 69 // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits). |
77 void CreateMimeBoundaryForUpload(std::string *out); | 70 void CreateMimeBoundaryForUpload(std::string *out); |
78 | 71 |
79 // Returns an MD5 hash for |printer_tags| and the default required tags. | 72 // Returns an MD5 hash for |printer_tags| and the default required tags. |
80 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags); | 73 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags); |
81 | 74 |
82 // Returns the post data for |printer_tags| and the default required tags. | 75 // Returns the post data for |printer_tags| and the default required tags. |
83 std::string GetPostDataForPrinterTags( | 76 std::string GetPostDataForPrinterTags( |
84 const PrinterTags& printer_tags, | 77 const PrinterTags& printer_tags, |
85 const std::string& mime_boundary, | 78 const std::string& mime_boundary, |
86 const std::string& proxy_tag_prefix, | 79 const std::string& proxy_tag_prefix, |
87 const std::string& tags_hash_tag_name); | 80 const std::string& tags_hash_tag_name); |
88 | 81 |
89 // Get the cloud print auth header from |auth_token|. | 82 // Get the cloud print auth header from |auth_token|. |
90 std::string GetCloudPrintAuthHeader(const std::string& auth_token); | 83 std::string GetCloudPrintAuthHeader(const std::string& auth_token); |
91 | 84 |
92 } // namespace cloud_print | 85 } // namespace cloud_print |
93 | 86 |
94 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 87 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
OLD | NEW |