aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/googledrive/googledrivestorage.h
diff options
context:
space:
mode:
Diffstat (limited to 'backends/cloud/googledrive/googledrivestorage.h')
-rw-r--r--backends/cloud/googledrive/googledrivestorage.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/backends/cloud/googledrive/googledrivestorage.h b/backends/cloud/googledrive/googledrivestorage.h
index d0585bc403..30bc9ab3f5 100644
--- a/backends/cloud/googledrive/googledrivestorage.h
+++ b/backends/cloud/googledrive/googledrivestorage.h
@@ -30,18 +30,10 @@ namespace Cloud {
namespace GoogleDrive {
class GoogleDriveStorage: public Id::IdStorage {
- static char *KEY, *SECRET;
-
- static void loadKeyAndSecret();
-
- Common::String _token, _refreshToken;
-
/** This private constructor is called from loadFromConfig(). */
GoogleDriveStorage(Common::String token, Common::String refreshToken);
void tokenRefreshed(BoolCallback callback, Networking::JsonResponse response);
- void codeFlowComplete(BoolResponse response);
- void codeFlowFailed(Networking::ErrorResponse error);
/** Constructs StorageInfo based on JSON response from cloud. */
void infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse json);
@@ -50,6 +42,18 @@ class GoogleDriveStorage: public Id::IdStorage {
void createDirectoryInnerCallback(BoolCallback outerCallback, Networking::JsonResponse json);
void printInfo(StorageInfoResponse response);
+
+protected:
+ /**
+ * @return "gdrive"
+ */
+ virtual Common::String cloudProvider();
+
+ /**
+ * @return kStorageGoogleDriveId
+ */
+ virtual uint32 storageIndex();
+
public:
/** This constructor uses OAuth code flow to get tokens. */
GoogleDriveStorage(Common::String code);
@@ -103,11 +107,10 @@ public:
virtual Common::String getRootDirectoryId();
/**
- * Gets new access_token. If <code> passed is "", refresh_token is used.
- * Use "" in order to refresh token and pass a callback, so you could
+ * Gets new access_token. Pass a callback, so you could
* continue your work when new token is available.
*/
- void getAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback = nullptr, Common::String code = "");
+ void refreshAccessToken(BoolCallback callback, Networking::ErrorCallback errorCallback = nullptr);
Common::String accessToken() const { return _token; }
};