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 #include "base/time/time.h" 13 #include "cloud_print/gcp20/prototype/local_settings.h" 14 15 namespace base { 16 17 class DictionaryValue; 18 19 } // namespace base 20 21 namespace cloud_print_response_parser { 22 23 struct Job { 24 Job(); 25 ~Job(); 26 27 std::string job_id; 28 base::Time create_time; 29 std::string file_url; 30 std::string ticket_url; 31 std::string title; 32 33 // Downloaded data: 34 std::string file; 35 std::string ticket; 36 }; 37 38 // Parses CloudPrint register start response to out parameters. 39 // Returns |true| on success. 40 bool ParseRegisterStartResponse(const std::string& response, 41 std::string* error_description, 42 std::string* polling_url, 43 std::string* registration_token, 44 std::string* complete_invite_url, 45 std::string* device_id); 46 47 // Parses CloudPrint register complete response to out parameters. 48 // Returns |true| on success. 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. 56 bool ParseFetchResponse(const std::string& response, 57 std::string* error_description, 58 std::vector<Job>* list); 59 60 // Parses CloudPrint printer response to get Local Settings. 61 // Returns |true| on success. 62 bool ParseLocalSettingsResponse(const std::string& response, 63 std::string* error_description, 64 LocalSettings::State* state, 65 LocalSettings* settings); 66 67 } // namespace cloud_print_response_parser 68 69 #endif // CLOUD_PRINT_GCP20_PROTOTYPE_CLOUD_PRINT_RESPONSE_PARSER_H_ 70 71