ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <basestorage.h>

Inheritance diagram for Cloud::BaseStorage:
Collaboration diagram for Cloud::BaseStorage:

List of all members.

Public Member Functions

 BaseStorage ()
 BaseStorage (Common::String token, Common::String refreshToken, bool enabled=false)
virtual ~BaseStorage ()
virtual void refreshAccessToken (BoolCallback callback, Networking::ErrorCallback errorCallback=nullptr)
 Gets new access_token.

Protected Member Functions

virtual void getAccessToken (Common::String code, Networking::ErrorCallback callback)
 Gets token from cloud.scummvm.org using given code.
virtual void codeFlowComplete (Networking::ErrorCallback callback, Networking::JsonResponse response)
 Handles JSON response which should contain access token requested with getAccessToken().
virtual void codeFlowFailed (Networking::ErrorCallback callback, Networking::ErrorResponse error)
 Handles network errors occurred while getting access token requested with getAccessToken().
virtual Common::String cloudProvider ()=0
 Return cloud provider name, used in cloud.scummvm.org endpoints.
virtual uint32 storageIndex ()=0
 Return CloudManager's StorageID for this storage.
virtual bool needsRefreshToken ()=0
 Return whether storage needs refresh_token to work.
virtual bool canReuseRefreshToken ()=0
 Return whether to expect new refresh_token on refresh.
void saveIsEnabledFlag (const Common::String &keyPrefix) const
 Helper function to save Storage::_isEnabled into config.

Static Protected Member Functions

static bool loadIsEnabledFlag (const Common::String &keyPrefix)
 Helper function to load Storage::_isEnabled value from config.
static void removeIsEnabledFlag (const Common::String &keyPrefix)
 Helper function to remove Storage::_isEnabled from config.

Protected Attributes

Common::String _token
 Storage's access and refresh tokens.
Common::String _refreshToken

Private Member Functions

void tokenRefreshed (BoolCallback callback, Networking::JsonResponse response)

Detailed Description

Definition at line 31 of file basestorage.h.


Constructor & Destructor Documentation

Cloud::BaseStorage::BaseStorage (  ) 

Definition at line 33 of file basestorage.cpp.

Cloud::BaseStorage::BaseStorage ( Common::String  token,
Common::String  refreshToken,
bool  enabled = false 
)

Definition at line 35 of file basestorage.cpp.

Cloud::BaseStorage::~BaseStorage (  )  [virtual]

Definition at line 40 of file basestorage.cpp.


Member Function Documentation

virtual bool Cloud::BaseStorage::canReuseRefreshToken (  )  [protected, pure virtual]

Return whether to expect new refresh_token on refresh.

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

virtual Common::String Cloud::BaseStorage::cloudProvider (  )  [protected, pure virtual]

Return cloud provider name, used in cloud.scummvm.org endpoints.

Returns:
cloud provider (for example, "dropbox").

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

void Cloud::BaseStorage::codeFlowComplete ( Networking::ErrorCallback  callback,
Networking::JsonResponse  response 
) [protected, virtual]

Handles JSON response which should contain access token requested with getAccessToken().

Definition at line 52 of file basestorage.cpp.

void Cloud::BaseStorage::codeFlowFailed ( Networking::ErrorCallback  callback,
Networking::ErrorResponse  error 
) [protected, virtual]

Handles network errors occurred while getting access token requested with getAccessToken().

Definition at line 123 of file basestorage.cpp.

void Cloud::BaseStorage::getAccessToken ( Common::String  code,
Networking::ErrorCallback  callback 
) [protected, virtual]

Gets token from cloud.scummvm.org using given code.

Base implementation for storages with common auth procedure.

Definition at line 42 of file basestorage.cpp.

bool Cloud::BaseStorage::loadIsEnabledFlag ( const Common::String keyPrefix  )  [static, protected]

Helper function to load Storage::_isEnabled value from config.

Definition at line 221 of file basestorage.cpp.

virtual bool Cloud::BaseStorage::needsRefreshToken (  )  [protected, pure virtual]
void Cloud::BaseStorage::refreshAccessToken ( BoolCallback  callback,
Networking::ErrorCallback  errorCallback = nullptr 
) [virtual]

Gets new access_token.

Pass a callback, so you could continue your work when new token is available.

Definition at line 133 of file basestorage.cpp.

void Cloud::BaseStorage::removeIsEnabledFlag ( const Common::String keyPrefix  )  [static, protected]

Helper function to remove Storage::_isEnabled from config.

Definition at line 229 of file basestorage.cpp.

void Cloud::BaseStorage::saveIsEnabledFlag ( const Common::String keyPrefix  )  const [protected]

Helper function to save Storage::_isEnabled into config.

Definition at line 217 of file basestorage.cpp.

virtual uint32 Cloud::BaseStorage::storageIndex (  )  [protected, pure virtual]

Return CloudManager's StorageID for this storage.

Returns:
StorageID corresponding to this storage (for example, kStorageDropboxId).

Implemented in Cloud::Box::BoxStorage, Cloud::Dropbox::DropboxStorage, Cloud::GoogleDrive::GoogleDriveStorage, and Cloud::OneDrive::OneDriveStorage.

void Cloud::BaseStorage::tokenRefreshed ( BoolCallback  callback,
Networking::JsonResponse  response 
) [private]

Definition at line 150 of file basestorage.cpp.


Member Data Documentation

Definition at line 34 of file basestorage.h.

Storage's access and refresh tokens.

Definition at line 34 of file basestorage.h.


The documentation for this class was generated from the following files:


Generated on Sat Aug 8 2020 05:03:04 for ResidualVM by doxygen 1.7.1
curved edge   curved edge