aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/onedrive/onedrivestorage.h
diff options
context:
space:
mode:
authorAlexander Tkachev2016-05-24 23:08:48 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit5e346ea6fbcd4a028bc7dd63efd09ff42770f8ef (patch)
tree7cd7d12110bbc731c71a6a5eeebf55b30acddbc2 /backends/cloud/onedrive/onedrivestorage.h
parent5f4bbe6e9e08f5f76eada84497a7530ffb08fbf1 (diff)
downloadscummvm-rg350-5e346ea6fbcd4a028bc7dd63efd09ff42770f8ef.tar.gz
scummvm-rg350-5e346ea6fbcd4a028bc7dd63efd09ff42770f8ef.tar.bz2
scummvm-rg350-5e346ea6fbcd4a028bc7dd63efd09ff42770f8ef.zip
CLOUD: Add OneDrive refresh_token support
It might be not that easy to restart the request after new token received, though.
Diffstat (limited to 'backends/cloud/onedrive/onedrivestorage.h')
-rw-r--r--backends/cloud/onedrive/onedrivestorage.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/backends/cloud/onedrive/onedrivestorage.h b/backends/cloud/onedrive/onedrivestorage.h
index 99f8476bc1..28f37aee2c 100644
--- a/backends/cloud/onedrive/onedrivestorage.h
+++ b/backends/cloud/onedrive/onedrivestorage.h
@@ -32,13 +32,28 @@ namespace OneDrive {
class OneDriveStorage: public Cloud::Storage {
static Common::String KEY, SECRET;
- Common::String _token, _uid;
+ Common::String _token, _uid, _refreshToken;
/** This private constructor is called from loadFromConfig(). */
- OneDriveStorage(Common::String token, Common::String uid);
+ OneDriveStorage(Common::String token, Common::String uid, Common::String refreshToken);
- static void getAccessToken(Common::String code);
+ /**
+ * This private constructor is called from authThroughConsole() (phase 2).
+ * It uses OAuth code flow to get tokens.
+ */
+ OneDriveStorage(Common::String code);
+
+ /**
+ * 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
+ * continue your work when new token is available.
+ */
+ void getAccessToken(BoolCallback callback, Common::String code = "");
+ void tokenRefreshed(BoolCallback callback, void *jsonPointer);
+ void codeFlowComplete(bool success);
+ void printJson(void *jsonPointer);
+ void printJsonTokenReceived(bool success);
public:
virtual ~OneDriveStorage();
@@ -92,11 +107,6 @@ public:
virtual bool isWorking() { return false; } //TODO
/**
- * Add OneDriveStorage with given token and uid into Cloud::Manager.
- */
- static void addStorage(Common::String token, Common::String uid);
-
- /**
* Load token and user id from configs and return OneDriveStorage for those.
* @return pointer to the newly created OneDriveStorage or 0 if some problem occured.
*/