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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
(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 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
18
19 static const char DRIVE_URL[] = "https://www.googleapis.com/drive/v3/files";
20 static const char UPLOAD_DRIVE_URL[] =
21 "https://www.googleapis.com/upload/drive/v3/files";
22 static const char DOWNLOAD_DRIVE_URL[] =
23 "https://www.googleapis.com/download/drive/v3/files";
24
25 struct RequestUrlParams {
26 std::string url;
27 std::string method;
28 std::string headers;
29 std::string body;
30 };
31
32 std::string ParentEqualClause(const std::string& parent_dir_id);
33 std::string NameEqualClause(const std::string& name);
34
35 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
36 int ExtractMonthFromRFC3339(const std::string& date_time);
37 int ExtractDayFromRFC3339(const std::string& date_time);
38 int ExtractHourFromRFC3339(const std::string& date_time);
39 int ExtractMinuteFromRFC3339(const std::string& date_time);
40 int ExtractSecondFromRFC3339(const std::string& date_time);
41
42 time_t ConvertDateTimeToEpochTime(int year,
43 int month,
44 int day,
45 int hour,
46 int minute,
47 int second);
48
49 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
50 void AddUrlQAttributeValue(std::string* array,
51 size_t size,
52 std::string* out_q_attribute_value);
53 void AddUrlFirstQueryParameter(const std::string& attribute,
54 const std::string& value,
55 std::string* out_url);
56 void AddUrlNextQueryParameter(const std::string& attribute,
57 const std::string& value,
58 std::string* out_url);
59 void AddHeaders(const std::string& header_field_key,
60 const std::string& header_field_value,
61 std::string* out_headers);
62 void AddBody(const std::string& data, std::string* out_body);
63 Error LoadUrl(PepperInterface* ppapi,
64 const RequestUrlParams& params,
65 ScopedResource* out_url_response_info_resource);
66 Error ReadResponseBody(PepperInterface* ppapi,
67 PP_Resource url_response_info_object,
68 int32_t bytes_to_read,
69 std::string* out_output);
70 int32_t ReadStatusCode(PepperInterface* ppapi,
71 PP_Resource url_response_info_object);
72 Error GetValueStringAndValuePos(const std::string& json,
73 const std::string& key,
74 size_t key_search_pos,
75 std::string* out_value_string,
76 size_t* out_value_pos);
77 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
78 const std::string& item_name,
79 Filesystem* filesystem,
80 std::string* out_item_id,
81 bool* out_is_dir_type);
82 Error RequestParentDirId(const Path& path,
83 Filesystem* filesystem,
84 std::string* out_parent_dir_id);
85 } // namespace nacl_io
86
87 #endif // LIBRARIES_NACL_IO_GOOGLEDRIVEFS_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698