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 #include "chrome/common/cloud_print/cloud_print_helpers.h" | 5 #include "chrome/common/cloud_print/cloud_print_helpers.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 } | 185 } |
186 | 186 |
187 std::unique_ptr<base::DictionaryValue> ParseResponseJSON( | 187 std::unique_ptr<base::DictionaryValue> ParseResponseJSON( |
188 const std::string& response_data, | 188 const std::string& response_data, |
189 bool* succeeded) { | 189 bool* succeeded) { |
190 std::unique_ptr<base::Value> message_value( | 190 std::unique_ptr<base::Value> message_value( |
191 base::JSONReader::Read(response_data)); | 191 base::JSONReader::Read(response_data)); |
192 if (!message_value.get()) | 192 if (!message_value.get()) |
193 return std::unique_ptr<base::DictionaryValue>(); | 193 return std::unique_ptr<base::DictionaryValue>(); |
194 | 194 |
195 if (!message_value->IsType(base::Value::TYPE_DICTIONARY)) | 195 if (!message_value->IsType(base::Value::Type::DICTIONARY)) |
196 return std::unique_ptr<base::DictionaryValue>(); | 196 return std::unique_ptr<base::DictionaryValue>(); |
197 | 197 |
198 std::unique_ptr<base::DictionaryValue> response_dict( | 198 std::unique_ptr<base::DictionaryValue> response_dict( |
199 static_cast<base::DictionaryValue*>(message_value.release())); | 199 static_cast<base::DictionaryValue*>(message_value.release())); |
200 if (succeeded && | 200 if (succeeded && |
201 !response_dict->GetBoolean(kSuccessValue, succeeded)) | 201 !response_dict->GetBoolean(kSuccessValue, succeeded)) |
202 *succeeded = false; | 202 *succeeded = false; |
203 return response_dict; | 203 return response_dict; |
204 } | 204 } |
205 | 205 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, | 238 net::AddMultipartValueForUpload(kPrinterTagValue, tags_hash_msg, |
239 mime_boundary, std::string(), &post_data); | 239 mime_boundary, std::string(), &post_data); |
240 return post_data; | 240 return post_data; |
241 } | 241 } |
242 | 242 |
243 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { | 243 std::string GetCloudPrintAuthHeader(const std::string& auth_token) { |
244 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); | 244 return base::StringPrintf("Authorization: OAuth %s", auth_token.c_str()); |
245 } | 245 } |
246 | 246 |
247 } // namespace cloud_print | 247 } // namespace cloud_print |
OLD | NEW |