Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1179)

Unified Diff: native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h

Issue 2156503002: [NaCl SDK] Expose Google Drive to nacl_io. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698