1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_RESPONSE_PARSER_H_ 6 #define CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_RESPONSE_PARSER_H_ 7 8 #include <string> 9 #include <vector> 10 11 #include "base/callback.h" 12 13 namespace base { 14 15 class DictionaryValue; 16 17 } // namespace base 18 19 namespace cloud_print_response_parser { 20 21 struct Job { 22 Job(); 23 ~Job(); 24 25 std::string job_id; 26 std::string create_time; 27 std::string file_url; 28 std::string ticket_url; 29 std::string title; 30 31 // Downloaded data: 32 std::string file; 33 std::string ticket; 34 }; 35 36 // Parses CloudPrint register start response to out parameters. 37 // Returns |true| on success. Callback is called with description as a parameter 38 // when parsing is failed. 39 bool ParseRegisterStartResponse(const std::string& response, 40 std::string* error_description, 41 std::string* polling_url, 42 std::string* registration_token, 43 std::string* complete_invite_url, 44 std::string* device_id); 45 46 // Parses CloudPrint register complete response to out parameters. 47 // Returns |true| on success. Callback is called with description as a parameter 48 // when parsing is failed. 49 bool ParseRegisterCompleteResponse(const std::string& response, 50 std::string* error_description, 51 std::string* authorization_code, 52 std::string* xmpp_jid); 53 54 // Parses CloudPrint fetch response to out parameters. 55 // Returns |true| on success. Callback is called with description as a parameter 56 // when parsing is failed. 57 bool ParseFetchResponse(const std::string& response, 58 std::string* error_description, 59 std::vector<Job>* list); 60 61 } // namespace cloud_print_response_parser 62 63 #endif // CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_RESPONSE_PARSER_H_ 64 65