Index: native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h |
diff --git a/native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h b/native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c72996ab5a81c3bb6ba563e205a5764b6222f16 |
--- /dev/null |
+++ b/native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h |
@@ -0,0 +1,74 @@ |
+// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |
+#define LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |
+ |
+#include <stdlib.h> |
+ |
+#include "nacl_io/error.h" |
+#include "nacl_io/filesystem.h" |
+#include "nacl_io/path.h" |
+#include "nacl_io/pepper_interface.h" |
+ |
+namespace nacl_io { |
+ |
+struct RequestUrlParams { |
+ std::string url; |
+ std::string method; |
+ std::string headers; |
+ std::string body; |
+}; |
+ |
+void AddUrlPath(const std::string& path, std::string* out_url); |
+void AddUrlQAttributeValue(std::string* array, |
+ int size, |
+ std::string* out_q_attribute_value); |
+void AddUrlFirstQueryParameter(const std::string& attribute, |
+ const std::string& value, |
+ std::string* out_url); |
+void AddUrlNextQueryParameter(const std::string& attribute, |
+ const std::string& value, |
+ std::string* out_url); |
+void AddHeaders(const std::string& header_field_key, |
+ const std::string& header_field_value, |
+ std::string* out_headers); |
+void AddBody(const std::string& data, std::string* out_body); |
+Error FinishPreparingResponse(PepperInterface* ppapi, |
+ PP_Resource url_loader_object, |
+ PP_Resource* out_url_response_info_object); |
+Error MakeRequest(PepperInterface* ppapi, |
+ PP_Resource url_loader_object, |
+ PP_Resource url_request_info_object, |
+ const RequestUrlParams& params); |
+Error ReadResponseBody(PepperInterface* ppapi, |
+ PP_Instance instance, |
+ PP_Resource url_response_info_object, |
+ int32_t bytes_to_read, |
+ std::string* out_output); |
+int32_t ReadStatusCode(PepperInterface* ppapi, |
+ PP_Resource url_response_info_object); |
+void GetValue(const std::string& json, |
+ const std::string& key, |
+ int find_pos, |
+ std::string* out_value, |
+ int* out_value_char_pos); |
+Error RequestDirId(const std::string& parent_dir_id, |
+ const std::string& dir_name, |
+ Filesystem* filesystem, |
+ std::string* out_dir_id); |
+Error RequestItemId(const std::string& parent_dir_id, |
+ const std::string& item_name, |
+ Filesystem* filesystem, |
+ std::string* out_item_id); |
+Error RequestParentDirId(const Path& path, |
+ Filesystem* filesystem, |
+ std::string* out_parent_dir_id); |
+Error GetListFileResponseBody(const std::string& url, |
+ Filesystem* filesystem, |
+ std::string* out_response_body); |
+ |
+} // namespace nacl_io |
+ |
+#endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |