Chromium Code Reviews| 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..850986cbb10382fd59aea3064fbed5c8a93b5460 |
| --- /dev/null |
| +++ b/native_client_sdk/src/libraries/nacl_io/googledrivefs/googledrivefs_util.h |
| @@ -0,0 +1,87 @@ |
| +// 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 { |
| + |
| +static const char FOLDER_MIME_TYPE[] = "application/vnd.google-apps.folder"; |
|
binji
2016/09/20 01:22:05
you shouldn't define static variables in a header
binji
2016/09/20 01:22:05
All of these values and functions has relatively g
chanpatorikku
2016/09/21 16:41:09
~250 bytes are going to be duplicated.
Code chan
chanpatorikku
2016/09/21 16:41:09
There're variables specific to a class in other fi
|
| + |
| +static const char DRIVE_URL[] = "https://www.googleapis.com/drive/v3/files"; |
| +static const char UPLOAD_DRIVE_URL[] = |
| + "https://www.googleapis.com/upload/drive/v3/files"; |
| +static const char DOWNLOAD_DRIVE_URL[] = |
| + "https://www.googleapis.com/download/drive/v3/files"; |
| + |
| +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); |
|
binji
2016/09/20 01:22:05
are these ever used independently from ConvertDate
chanpatorikku
2016/09/21 16:41:09
No, these are not ever used independently from Con
|
| +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); |
|
binji
2016/09/20 01:22:05
As mentioned before, a nicer API would be to make
chanpatorikku
2016/09/21 16:41:09
The reply of this message was done for another mes
|
| +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, |
|
binji
2016/09/20 01:22:05
why aren't these functions on GoogleFilesystemFS?
chanpatorikku
2016/09/21 16:41:09
If what you mean is that why aren't these function
|
| + const std::string& item_name, |
| + Filesystem* filesystem, |
| + std::string* out_item_id, |
| + bool* out_is_dir_type); |
| +Error RequestParentDirId(const Path& path, |
| + Filesystem* filesystem, |
| + std::string* out_parent_dir_id); |
| +} // namespace nacl_io |
| + |
| +#endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_ |