-
Notifications
You must be signed in to change notification settings - Fork 892
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves brave/brave-browser#4017
- Loading branch information
Showing
8 changed files
with
116 additions
and
0 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
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
38 changes: 38 additions & 0 deletions
38
vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.cc
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,38 @@ | ||
/* 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/bat_helper.h" | ||
#include "bat/ledger/internal/ledger_impl.h" | ||
#include "bat/ledger/internal/media/vimeo.h" | ||
|
||
using std::placeholders::_1; | ||
using std::placeholders::_2; | ||
|
||
namespace braveledger_media { | ||
|
||
Vimeo::Vimeo(bat_ledger::LedgerImpl* ledger): | ||
ledger_(ledger) { | ||
} | ||
|
||
Vimeo::~Vimeo() { | ||
} | ||
|
||
// static | ||
std::string Vimeo::GetLinkType(const std::string& url) { | ||
std::string type = VIMEO_MEDIA_TYPE; | ||
return type; | ||
} | ||
|
||
void Vimeo::ProcessMedia(const std::map<std::string, std::string>& parts, | ||
const ledger::VisitData& visit_data) { | ||
|
||
} | ||
|
||
void Vimeo::ProcessActivityFromUrl(uint64_t window_id, | ||
const ledger::VisitData& visit_data) { | ||
|
||
} | ||
|
||
} // namespace braveledger_media |
46 changes: 46 additions & 0 deletions
46
vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo.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,46 @@ | ||
/* 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_VIMEO_H_ | ||
#define BRAVELEDGER_MEDIA_VIMEO_H_ | ||
|
||
#include <map> | ||
#include <string> | ||
|
||
#include "base/gtest_prod_util.h" | ||
#include "bat/ledger/ledger.h" | ||
#include "bat/ledger/internal/media/helper.h" | ||
|
||
namespace bat_ledger { | ||
class LedgerImpl; | ||
} | ||
|
||
namespace braveledger_media { | ||
|
||
class Vimeo : public ledger::LedgerCallbackHandler { | ||
public: | ||
explicit Vimeo(bat_ledger::LedgerImpl* ledger); | ||
|
||
~Vimeo() override; | ||
|
||
void ProcessMedia(const std::map<std::string, std::string>& parts, | ||
const ledger::VisitData& visit_data); | ||
|
||
static std::string GetLinkType(const std::string& url); | ||
|
||
void ProcessActivityFromUrl(uint64_t window_id, | ||
const ledger::VisitData& visit_data); | ||
|
||
private: | ||
|
||
bat_ledger::LedgerImpl* ledger_; // NOT OWNED | ||
|
||
// For testing purposes | ||
friend class VimeoTest; | ||
}; | ||
|
||
} // namespace braveledger_media | ||
|
||
#endif // BRAVELEDGER_MEDIA_VIMEO_H_ |
23 changes: 23 additions & 0 deletions
23
vendor/bat-native-ledger/src/bat/ledger/internal/media/vimeo_unittest.cc
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,23 @@ | ||
/* 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/vimeo.h" | ||
#include "bat/ledger/ledger.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
// npm run test -- brave_unit_tests --filter=VimeoTest.* | ||
|
||
namespace braveledger_media { | ||
|
||
class VimeoTest : public testing::Test { | ||
}; | ||
|
||
TEST(VimeoTest, GetLinkType) { | ||
// TODO(nejczdovc): change me | ||
std::string result = Vimeo::GetLinkType("https://vimeo.com/video/32342"); | ||
ASSERT_EQ(result, "vimeo"); | ||
} | ||
|
||
} // namespace braveledger_media |
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