Skip to content

Commit

Permalink
Merge pull request #4252 from brave/db-migration-2
Browse files Browse the repository at this point in the history
Db migration 2
  • Loading branch information
NejcZdovc authored Feb 28, 2020
2 parents 8eb456a + 8459e95 commit c8dff0f
Show file tree
Hide file tree
Showing 154 changed files with 11,956 additions and 14,665 deletions.
37 changes: 8 additions & 29 deletions browser/ui/webui/brave_rewards_page_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ class RewardsDOMHandler : public WebUIMessageHandler,
void SaveSetting(const base::ListValue* args);
void UpdateAdsRewards(const base::ListValue* args);
void OnContentSiteList(
std::unique_ptr<brave_rewards::ContentSiteList>,
uint32_t record);
std::unique_ptr<brave_rewards::ContentSiteList>);
void OnExcludedSiteList(
std::unique_ptr<brave_rewards::ContentSiteList>,
uint32_t record);
std::unique_ptr<brave_rewards::ContentSiteList>);
void ExcludePublisher(const base::ListValue* args);
void RestorePublishers(const base::ListValue* args);
void RestorePublisher(const base::ListValue* args);
Expand Down Expand Up @@ -140,8 +138,6 @@ class RewardsDOMHandler : public WebUIMessageHandler,
void GetRewardsMainEnabled(const base::ListValue* args);
void OnGetRewardsMainEnabled(bool enabled);
void GetExcludedSites(const base::ListValue* args);
void OnAutoContributePropsReadyExcluded(
std::unique_ptr<brave_rewards::AutoContributeProps> auto_contri_props);

void OnTransactionHistory(
double estimated_pending_rewards,
Expand Down Expand Up @@ -764,25 +760,10 @@ void RewardsDOMHandler::OnAutoContributePropsReady(
props->reconcile_stamp,
props->contribution_non_verified,
props->contribution_min_visits,
false,
base::Bind(&RewardsDOMHandler::OnContentSiteList,
weak_factory_.GetWeakPtr()));
}

void RewardsDOMHandler::OnAutoContributePropsReadyExcluded(
std::unique_ptr<brave_rewards::AutoContributeProps> props) {
rewards_service_->GetContentSiteList(
0,
0,
props->contribution_min_time,
props->reconcile_stamp,
props->contribution_non_verified,
props->contribution_min_visits,
true,
base::Bind(&RewardsDOMHandler::OnExcludedSiteList,
weak_factory_.GetWeakPtr()));
}

void RewardsDOMHandler::OnContentSiteUpdated(
brave_rewards::RewardsService* rewards_service) {
rewards_service_->GetAutoContributeProps(
Expand All @@ -791,9 +772,9 @@ void RewardsDOMHandler::OnContentSiteUpdated(
}

void RewardsDOMHandler::GetExcludedSites(const base::ListValue* args) {
rewards_service_->GetAutoContributeProps(
base::Bind(&RewardsDOMHandler::OnAutoContributePropsReadyExcluded,
weak_factory_.GetWeakPtr()));
rewards_service_->GetExcludedList(
base::Bind(&RewardsDOMHandler::OnExcludedSiteList,
weak_factory_.GetWeakPtr()));
}

void RewardsDOMHandler::OnExcludedSitesChanged(
Expand Down Expand Up @@ -917,8 +898,7 @@ void RewardsDOMHandler::RestorePublisher(const base::ListValue *args) {
}

void RewardsDOMHandler::OnContentSiteList(
std::unique_ptr<brave_rewards::ContentSiteList> list,
uint32_t record) {
std::unique_ptr<brave_rewards::ContentSiteList> list) {
if (web_ui()->CanCallJavascript()) {
auto publishers = std::make_unique<base::ListValue>();
for (auto const& item : *list) {
Expand All @@ -941,8 +921,7 @@ void RewardsDOMHandler::OnContentSiteList(
}

void RewardsDOMHandler::OnExcludedSiteList(
std::unique_ptr<brave_rewards::ContentSiteList> list,
uint32_t record) {
std::unique_ptr<brave_rewards::ContentSiteList> list) {
if (web_ui()->CanCallJavascript()) {
auto publishers = std::make_unique<base::ListValue>();
for (auto const& item : *list) {
Expand Down Expand Up @@ -1389,7 +1368,7 @@ void RewardsDOMHandler::OnRewardsMainEnabled(
void RewardsDOMHandler::OnPublisherListNormalized(
brave_rewards::RewardsService* rewards_service,
const brave_rewards::ContentSiteList& list) {
OnContentSiteList(std::make_unique<brave_rewards::ContentSiteList>(list), 0);
OnContentSiteList(std::make_unique<brave_rewards::ContentSiteList>(list));
}

void RewardsDOMHandler::GetTransactionHistory(
Expand Down
5 changes: 3 additions & 2 deletions components/brave_ads/browser/ads_service_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ class MockRewardsService : public RewardsService {

MOCK_METHOD1(CreateWallet, void(brave_rewards::CreateWalletCallback));
MOCK_METHOD0(FetchWalletProperties, void());
MOCK_METHOD8(GetContentSiteList,
MOCK_METHOD7(GetContentSiteList,
void(uint32_t,
uint32_t,
uint64_t,
uint64_t,
bool,
uint32_t,
bool,
const brave_rewards::GetContentSiteListCallback&));
MOCK_METHOD1(GetExcludedList,
void(const brave_rewards::GetContentSiteListCallback&));
MOCK_METHOD0(FetchPromotions, void());
MOCK_METHOD1(ClaimPromotion, void(brave_rewards::ClaimPromotionCallback));
MOCK_METHOD2(ClaimPromotion, void(const std::string&,
Expand Down
41 changes: 2 additions & 39 deletions components/brave_rewards/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ source_set("browser") {
"transaction_report_info.h",
"contribution_report_info.cc",
"contribution_report_info.h",
"rewards_database.h",
"rewards_database.cc",
]

deps = [
Expand All @@ -66,7 +68,6 @@ source_set("browser") {
"//content/public/browser",
"//content/public/common",
"//services/network/public/mojom",
"//third_party/leveldatabase",
]

if (!is_android) {
Expand All @@ -79,44 +80,6 @@ source_set("browser") {

if (brave_rewards_enabled) {
sources += [
"database/database_activity_info.cc",
"database/database_activity_info.h",
"database/database_contribution_info.cc",
"database/database_contribution_info.h",
"database/database_contribution_info_publishers.cc",
"database/database_contribution_info_publishers.h",
"database/database_contribution_queue.cc",
"database/database_contribution_queue.h",
"database/database_contribution_queue_publishers.cc",
"database/database_contribution_queue_publishers.h",
"database/database_media_publisher_info.cc",
"database/database_media_publisher_info.h",
"database/database_pending_contribution.cc",
"database/database_pending_contribution.h",
"database/database_promotion.cc",
"database/database_promotion.h",
"database/database_promotion_creds.cc",
"database/database_promotion_creds.h",
"database/database_publisher_info.cc",
"database/database_publisher_info.h",
"database/database_recurring_tip.cc",
"database/database_recurring_tip.h",
"database/database_server_publisher_amounts.cc",
"database/database_server_publisher_amounts.h",
"database/database_server_publisher_banner.cc",
"database/database_server_publisher_banner.h",
"database/database_server_publisher_info.cc",
"database/database_server_publisher_info.h",
"database/database_server_publisher_links.cc",
"database/database_server_publisher_links.h",
"database/database_table.cc",
"database/database_table.h",
"database/database_unblinded_token.cc",
"database/database_unblinded_token.h",
"database/database_util.cc",
"database/database_util.h",
"database/publisher_info_database.cc",
"database/publisher_info_database.h",
"net/network_delegate_helper.cc",
"net/network_delegate_helper.h",
"rewards_service_impl.cc",
Expand Down
Loading

0 comments on commit c8dff0f

Please sign in to comment.