Skip to content

Commit

Permalink
Base ground for the split
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Apr 17, 2019
1 parent 3661c1f commit 2433a9d
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 1 deletion.
6 changes: 6 additions & 0 deletions vendor/bat-native-ledger/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ source_set("ledger") {
"src/bat/ledger/internal/bignum.h",
"src/bat/ledger/internal/ledger_impl.cc",
"src/bat/ledger/internal/ledger_impl.h",
"src/bat/ledger/internal/media/helper.h",
"src/bat/ledger/internal/media/helper.cc",
"src/bat/ledger/internal/media/twitch.h",
"src/bat/ledger/internal/media/twitch.cc",
"src/bat/ledger/internal/media/youtube.h",
"src/bat/ledger/internal/media/youtube.cc",
"src/bat/ledger/ledger.cc",
"src/bat/ledger/transaction_info.cc",
"src/bat/ledger/transactions_info.cc",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ using std::placeholders::_3;
namespace braveledger_bat_get_media {

BatGetMedia::BatGetMedia(bat_ledger::LedgerImpl* ledger):
ledger_(ledger) {
ledger_(ledger),
media_youtube_(new braveledger_media::MediaYouTube(ledger)),
media_twitch_(new braveledger_media::MediaTwitch(ledger)) {
}

BatGetMedia::~BatGetMedia() {}
Expand Down
10 changes: 10 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/bat_get_media.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include "bat/ledger/internal/bat_helper.h"
#include "bat/ledger/ledger.h"

#include "bat/ledger/internal/media/youtube.h"
#include "bat/ledger/internal/media/twitch.h"

namespace bat_ledger {
class LedgerImpl;
}
Expand All @@ -22,6 +25,11 @@ namespace leveldb {
class DB;
}

//namespace braveledger_media {
//class MediaYouTube;
//class MediaTwitch;
//}

namespace braveledger_bat_get_media {

using FetchDataFromUrlCallback = std::function<void(
Expand Down Expand Up @@ -279,6 +287,8 @@ class BatGetMedia {
static std::string parsePublisherName(const std::string& data);

bat_ledger::LedgerImpl* ledger_; // NOT OWNED
std::unique_ptr<braveledger_media::MediaYouTube> media_youtube_;
std::unique_ptr<braveledger_media::MediaTwitch> media_twitch_;

std::map<std::string, ledger::TwitchEventInfo> twitchEvents;

Expand Down
12 changes: 12 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/helper.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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/internal/media/helper.h"


namespace braveledger_media {


} // namespace braveledger_media
15 changes: 15 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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 BRAVELEDGER_MEDIA_HELPER_H_
#define BRAVELEDGER_MEDIA_HELPER_H_

namespace braveledger_media {



} // namespace braveledger_media

#endif // BRAVELEDGER_MEDIA_HELPER_H_
22 changes: 22 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/twitch.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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/internal/ledger_impl.h"
#include "bat/ledger/internal/media/twitch.h"

using std::placeholders::_1;
using std::placeholders::_2;

namespace braveledger_media {

MediaTwitch::MediaTwitch(bat_ledger::LedgerImpl* ledger):
ledger_(ledger) {
}

MediaTwitch::~MediaTwitch() {
}


} // namespace braveledger_media
29 changes: 29 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/twitch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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 BRAVELEDGER_MEDIA_TWITCH_H_
#define BRAVELEDGER_MEDIA_TWITCH_H_

#include "bat/ledger/ledger.h"

namespace bat_ledger {
class LedgerImpl;
}

namespace braveledger_media {

class MediaTwitch : public ledger::LedgerCallbackHandler {
public:
explicit MediaTwitch(bat_ledger::LedgerImpl* ledger);

~MediaTwitch() override;

private:
bat_ledger::LedgerImpl* ledger_; // NOT OWNED
};

} // namespace braveledger_media

#endif // BRAVELEDGER_MEDIA_TWITCH_H_
22 changes: 22 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/youtube.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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/internal/ledger_impl.h"
#include "bat/ledger/internal/media/youtube.h"

using std::placeholders::_1;
using std::placeholders::_2;

namespace braveledger_media {

MediaYouTube::MediaYouTube(bat_ledger::LedgerImpl* ledger):
ledger_(ledger) {
}

MediaYouTube::~MediaYouTube() {
}


} // namespace braveledger_media
29 changes: 29 additions & 0 deletions vendor/bat-native-ledger/src/bat/ledger/internal/media/youtube.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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 BRAVELEDGER_MEDIA_YOUTUBE_H_
#define BRAVELEDGER_MEDIA_YOUTUBE_H_

#include "bat/ledger/ledger.h"

namespace bat_ledger {
class LedgerImpl;
}

namespace braveledger_media {

class MediaYouTube : public ledger::LedgerCallbackHandler {
public:
explicit MediaYouTube(bat_ledger::LedgerImpl* ledger);

~MediaYouTube() override;

private:
bat_ledger::LedgerImpl* ledger_; // NOT OWNED
};

} // namespace braveledger_media

#endif // BRAVELEDGER_MEDIA_YOUTUBE_H_

0 comments on commit 2433a9d

Please sign in to comment.