| 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..37b788af4c7b32781ea9b6f607ef7f07cd287d2f
|
| --- /dev/null
|
| +++ b/native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h
|
| @@ -0,0 +1,86 @@
|
| +// 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 {
|
| +
|
| +class GoogleDriveFs;
|
| +
|
| +extern const char FOLDER_MIME_TYPE[];
|
| +extern const char DRIVE_URL[];
|
| +extern const char UPLOAD_DRIVE_URL[];
|
| +extern const char DOWNLOAD_DRIVE_URL[];
|
| +
|
| +struct RequestUrlParams {
|
| + std::string url;
|
| + std::string method;
|
| + std::string headers;
|
| + std::string body;
|
| +};
|
| +
|
| +std::string ParentEqualClause(const std::string& parent_dir_id);
|
| +std::string NameEqualClause(const std::string& name);
|
| +
|
| +int ExtractYearFromRFC3339(const std::string& date_time);
|
| +int ExtractMonthFromRFC3339(const std::string& date_time);
|
| +int ExtractDayFromRFC3339(const std::string& date_time);
|
| +int ExtractHourFromRFC3339(const std::string& date_time);
|
| +int ExtractMinuteFromRFC3339(const std::string& date_time);
|
| +int ExtractSecondFromRFC3339(const std::string& date_time);
|
| +
|
| +time_t ConvertDateTimeToEpochTime(int year,
|
| + int month,
|
| + int day,
|
| + int hour,
|
| + int minute,
|
| + int second);
|
| +
|
| +void AddUrlPath(const std::string& path, std::string* out_url);
|
| +void AddUrlQAttributeValue(std::string* array,
|
| + size_t 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 LoadUrl(PepperInterface* ppapi,
|
| + const RequestUrlParams& params,
|
| + ScopedResource* out_url_response_info_resource);
|
| +Error ReadResponseBody(PepperInterface* ppapi,
|
| + 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);
|
| +Error GetValueStringAndValuePos(const std::string& json,
|
| + const std::string& key,
|
| + size_t key_search_pos,
|
| + std::string* out_value_string,
|
| + size_t* out_value_pos);
|
| +Error RequestItemIdAndItemType(const std::string& parent_dir_id,
|
| + const std::string& item_name,
|
| + GoogleDriveFs* googledrivefs,
|
| + std::string* out_item_id,
|
| + bool* out_is_dir_type);
|
| +Error RequestParentDirId(const Path& path,
|
| + GoogleDriveFs* googledrivefs,
|
| + std::string* out_parent_dir_id);
|
| +} // namespace nacl_io
|
| +
|
| +#endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_
|
|
|