-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from brave-intl/chromium-fixes-pt2
Chromium fixes pt2
- Loading branch information
Showing
32 changed files
with
1,270 additions
and
1,260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BAT_LEDGER_LEDGER_CALLBACK_HANDLER_ | ||
#define BAT_LEDGER_LEDGER_CALLBACK_HANDLER_ | ||
|
||
#include <string> | ||
|
||
namespace ledger { | ||
|
||
enum Result { | ||
OK = 0, | ||
ERROR = 1, | ||
// some more useful result codes should go here | ||
}; | ||
|
||
// LedgerCallbackHandler must not be destroyed if they have pending callbacks | ||
class LedgerCallbackHandler { | ||
public: | ||
virtual ~LedgerCallbackHandler() = default; | ||
|
||
virtual void OnLedgerStateLoaded(Result result, | ||
const std::string& data) {}; | ||
virtual void OnPublisherStateLoaded(Result result, | ||
const std::string& data) {}; | ||
virtual void OnPublisherStateSaved(Result result) {}; | ||
virtual void OnLedgerStateSaved(Result result) {}; | ||
virtual void OnURLRequestResponse(uint64_t request_id, | ||
int response_code, | ||
const std::string& response) {}; | ||
}; | ||
|
||
} // namespace ledger | ||
|
||
#endif // BAT_LEDGER_LEDGER_CALLBACK_HANDLER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BAT_LEDGER_LEDGER_CLIENT_H_ | ||
#define BAT_LEDGER_LEDGER_CLIENT_H_ | ||
|
||
#include <memory> | ||
|
||
#include "bat/ledger/ledger_callback_handler.h" | ||
#include "bat/ledger/ledger_task_runner.h" | ||
#include "bat/ledger/ledger_url_loader.h" | ||
|
||
namespace ledger { | ||
|
||
enum URL_METHOD { | ||
GET = 0, | ||
PUT = 1, | ||
POST = 2 | ||
}; | ||
|
||
class LedgerClient { | ||
public: | ||
virtual ~LedgerClient() = default; | ||
|
||
// called when the wallet creation has completed | ||
virtual std::string GenerateGUID() const = 0; | ||
virtual void OnWalletCreated(Result result) = 0; | ||
virtual void OnReconcileComplete(Result result, | ||
const std::string& viewing_id) = 0; | ||
virtual void LoadLedgerState(LedgerCallbackHandler* handler) = 0; | ||
virtual void LoadPublisherState(LedgerCallbackHandler* handler) = 0; | ||
virtual void SaveLedgerState(const std::string& ledger_state, | ||
LedgerCallbackHandler* handler) = 0; | ||
virtual void SavePublisherState(const std::string& publisher_state, | ||
LedgerCallbackHandler* handler) = 0; | ||
virtual std::unique_ptr<ledger::LedgerURLLoader> LoadURL(const std::string& url, | ||
const std::vector<std::string>& headers, | ||
const std::string& content, | ||
const std::string& contentType, | ||
const ledger::URL_METHOD& method, | ||
ledger::LedgerCallbackHandler* handler) = 0; | ||
// RunIOTask and RunTask are temporary workarounds for leveldb | ||
// and we should replace them with a ledger_client api for reading/writing | ||
// individual records | ||
virtual void RunIOTask(std::unique_ptr<LedgerTaskRunner> task) = 0; | ||
// If any callbacks are made from inside RunIOTask you must use | ||
// RunTask to return back to the calling thread | ||
virtual void RunTask(std::unique_ptr<LedgerTaskRunner> task) = 0; | ||
}; | ||
|
||
} // namespace ledger | ||
|
||
#endif // BAT_LEDGER_LEDGER_CLIENT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BAT_LEDGER_LEDGER_TASK_RUNNER_ | ||
#define BAT_LEDGER_LEDGER_TASK_RUNNER_ | ||
|
||
#include <string> | ||
|
||
namespace ledger { | ||
|
||
class LedgerTaskRunner { | ||
public: | ||
virtual ~LedgerTaskRunner() = default; | ||
virtual void Run() = 0; | ||
}; | ||
|
||
} // namespace ledger | ||
|
||
#endif // BAT_LEDGER_LEDGER_TASK_RUNNER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BAT_LEDGER_LEDGER_URL_LOADER_ | ||
#define BAT_LEDGER_LEDGER_URL_LOADER_ | ||
|
||
#include <string> | ||
|
||
namespace ledger { | ||
|
||
class LedgerURLLoader { | ||
public: | ||
virtual ~LedgerURLLoader() = default; | ||
virtual void Start() = 0; | ||
virtual uint64_t request_id() = 0; | ||
}; | ||
|
||
} // namespace ledger | ||
|
||
#endif // BAT_LEDGER_LEDGER_URL_LOADER_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "bat/ledger/ledger.h" | ||
|
||
#include "ledger_impl.h" | ||
|
||
namespace ledger { | ||
|
||
// static | ||
ledger::Ledger* Ledger::CreateInstance(LedgerClient* client) { | ||
return new bat_ledger::LedgerImpl(client); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.