| 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 <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class DictionaryValue; | 17 class DictionaryValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // Helper consts and methods for both cloud print and chrome browser. | 20 // Helper consts and methods for both cloud print and chrome browser. |
| 21 namespace cloud_print { | 21 namespace cloud_print { |
| 22 | 22 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 GURL GetUrlForUserMessage(const GURL& cloud_print_server_url, | 56 GURL GetUrlForUserMessage(const GURL& cloud_print_server_url, |
| 57 const std::string& message_id); | 57 const std::string& message_id); |
| 58 GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url, | 58 GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url, |
| 59 const std::string& oauth_client_id, | 59 const std::string& oauth_client_id, |
| 60 const std::string& proxy_id); | 60 const std::string& proxy_id); |
| 61 | 61 |
| 62 // Parses the response data for any cloud print server request. The method | 62 // Parses the response data for any cloud print server request. The method |
| 63 // returns null if there was an error in parsing the JSON. The succeeded | 63 // returns null if there was an error in parsing the JSON. The succeeded |
| 64 // value returns the value of the "success" value in the response JSON. | 64 // value returns the value of the "success" value in the response JSON. |
| 65 // Returns the response as a dictionary value. | 65 // Returns the response as a dictionary value. |
| 66 scoped_ptr<base::DictionaryValue> ParseResponseJSON( | 66 std::unique_ptr<base::DictionaryValue> ParseResponseJSON( |
| 67 const std::string& response_data, | 67 const std::string& response_data, |
| 68 bool* succeeded); | 68 bool* succeeded); |
| 69 | 69 |
| 70 // Returns the MIME type of multipart with |mime_boundary|. | 70 // Returns the MIME type of multipart with |mime_boundary|. |
| 71 std::string GetMultipartMimeType(const std::string& mime_boundary); | 71 std::string GetMultipartMimeType(const std::string& mime_boundary); |
| 72 | 72 |
| 73 // Returns an MD5 hash for |printer_tags| and the default required tags. | 73 // Returns an MD5 hash for |printer_tags| and the default required tags. |
| 74 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags); | 74 std::string GetHashOfPrinterTags(const PrinterTags& printer_tags); |
| 75 | 75 |
| 76 // Returns the post data for |printer_tags| and the default required tags. | 76 // Returns the post data for |printer_tags| and the default required tags. |
| 77 std::string GetPostDataForPrinterTags( | 77 std::string GetPostDataForPrinterTags( |
| 78 const PrinterTags& printer_tags, | 78 const PrinterTags& printer_tags, |
| 79 const std::string& mime_boundary, | 79 const std::string& mime_boundary, |
| 80 const std::string& proxy_tag_prefix, | 80 const std::string& proxy_tag_prefix, |
| 81 const std::string& tags_hash_tag_name); | 81 const std::string& tags_hash_tag_name); |
| 82 | 82 |
| 83 // Get the cloud print auth header from |auth_token|. | 83 // Get the cloud print auth header from |auth_token|. |
| 84 std::string GetCloudPrintAuthHeader(const std::string& auth_token); | 84 std::string GetCloudPrintAuthHeader(const std::string& auth_token); |
| 85 | 85 |
| 86 } // namespace cloud_print | 86 } // namespace cloud_print |
| 87 | 87 |
| 88 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ | 88 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_ |
| OLD | NEW |