OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 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 LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |
| 6 #define LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |
| 7 |
| 8 #include <stdlib.h> |
| 9 |
| 10 #include "nacl_io/error.h" |
| 11 #include "nacl_io/filesystem.h" |
| 12 #include "nacl_io/path.h" |
| 13 #include "nacl_io/pepper_interface.h" |
| 14 |
| 15 namespace nacl_io { |
| 16 |
| 17 struct RequestUrlParams { |
| 18 std::string url; |
| 19 std::string method; |
| 20 std::string headers; |
| 21 std::string body; |
| 22 }; |
| 23 |
| 24 void AddUrlPath(const std::string& path, std::string* out_url); |
| 25 void AddUrlQAttributeValue(std::string* array, |
| 26 int size, |
| 27 std::string* out_q_attribute_value); |
| 28 void AddUrlFirstQueryParameter(const std::string& attribute, |
| 29 const std::string& value, |
| 30 std::string* out_url); |
| 31 void AddUrlNextQueryParameter(const std::string& attribute, |
| 32 const std::string& value, |
| 33 std::string* out_url); |
| 34 void AddHeaders(const std::string& header_field_key, |
| 35 const std::string& header_field_value, |
| 36 std::string* out_headers); |
| 37 void AddBody(const std::string& data, std::string* out_body); |
| 38 Error FinishPreparingResponse(PepperInterface* ppapi, |
| 39 PP_Resource url_loader_object, |
| 40 PP_Resource* out_url_response_info_object); |
| 41 Error MakeRequest(PepperInterface* ppapi, |
| 42 PP_Resource url_loader_object, |
| 43 PP_Resource url_request_info_object, |
| 44 const RequestUrlParams& params); |
| 45 Error ReadResponseBody(PepperInterface* ppapi, |
| 46 PP_Instance instance, |
| 47 PP_Resource url_response_info_object, |
| 48 int32_t bytes_to_read, |
| 49 std::string* out_output); |
| 50 int32_t ReadStatusCode(PepperInterface* ppapi, |
| 51 PP_Resource url_response_info_object); |
| 52 void GetValue(const std::string& json, |
| 53 const std::string& key, |
| 54 int find_pos, |
| 55 std::string* out_value, |
| 56 int* out_value_char_pos); |
| 57 Error RequestDirId(const std::string& parent_dir_id, |
| 58 const std::string& dir_name, |
| 59 Filesystem* filesystem, |
| 60 std::string* out_dir_id); |
| 61 Error RequestItemId(const std::string& parent_dir_id, |
| 62 const std::string& item_name, |
| 63 Filesystem* filesystem, |
| 64 std::string* out_item_id); |
| 65 Error RequestParentDirId(const Path& path, |
| 66 Filesystem* filesystem, |
| 67 std::string* out_parent_dir_id); |
| 68 Error GetListFileResponseBody(const std::string& url, |
| 69 Filesystem* filesystem, |
| 70 std::string* out_response_body); |
| 71 |
| 72 } // namespace nacl_io |
| 73 |
| 74 #endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |
OLD | NEW |