Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Encapsulate dependencies #3

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 25 additions & 34 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,50 +1,41 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# 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/.

if (is_android) {
import("//build/config/android/rules.gni")
}
if (is_android) {
dep_base = rebase_path("..", "//")
} else {
dep_base = rebase_path("../..", "//")
}

config("internal_config") {
include_dirs = [ "../src" ]
defines = [ "BRAVE_LEDGER_LIB" ]
}

source_set("bat-native-ledger") {
configs += [ ":internal_config" ]

static_library("braveLedger") {
sources = [
"src/ledger.cc",
"src/bat_client.cc",
"src/bat_client_webrequest.cc",
"src/bat_client_webrequest_chromium.cc",
"src/bat_get_media.cc",
"src/bat_helper.cc",
"src/bat_publisher.cc",
"src/bat_helper_platform.cc",
"src/bat_publishers.cc",
"src/bat_balance.cc",
"src/tweetnacl.cc",
]

include_dirs = [
"src",
"//anonize2/anon",
"//anonize2/relic/include",
"//anonize2/relic/include/low",
"//bip39wally-core/include"
"src/ledger.cc",
]

deps = [
"//base",
"//net",
"//anonize2",
"//bip39wally-core",
"//v8",
"//net:net_utility_services",
"//net:net_with_v8",
"//v8:v8_libplatform",
"//third_party/leveldatabase",
rebase_path("bat-native-anonize:anonize2", dep_base),
rebase_path("bip39wally-core-native:bip39wally-core", dep_base),
rebase_path("bat-native-tweetnacl:tweetnacl", dep_base),
rebase_path("bat-native-rapidjson", dep_base),
]

include_dirs += [
"//base",
"//net/url_request",
"//url",
"//content/public/browser",
"//third_party/leveldatabase/src/include",
"//v8",
]

defines = [ "LEDGER_LIBRARY" ]
}
7 changes: 4 additions & 3 deletions src/bat_balance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "bat_balance.h"

#include "bat_helper.h"
#include "static_values.h"

namespace braveledger_bat_balance {


std::string BatBalance::buildURL(const std::string& path, const std::string& prefix) {
std::string url;
if (braveledger_ledger::g_isProduction) {
Expand All @@ -21,9 +22,9 @@ std::string BatBalance::buildURL(const std::string& path, const std::string& pre

void BatBalance::getWalletProperties(const std::string& paymentInfo, braveledger_bat_helper::FetchCallback callback,
const braveledger_bat_helper::FETCH_CALLBACK_EXTRA_DATA_ST& extraData) {

batClientWebRequest_.run(buildURL((std::string)WALLET_PROPERTIES + paymentInfo + WALLET_PROPERTIES_END, ""),
callback, std::vector<std::string>(), "", "", extraData, braveledger_bat_helper::URL_METHOD::GET);
}

} //namespace braveledger_bat_balance
} // namespace braveledger_bat_balance
15 changes: 7 additions & 8 deletions src/bat_balance.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,24 @@
#include "bat_client_webrequest.h"
#endif

#include "bat_helper.h"
namespace braveledger_bat_helper {
struct FETCH_CALLBACK_EXTRA_DATA_ST;
}

namespace braveledger_bat_balance
{
namespace braveledger_bat_balance {

class BatBalance {
public:
public:
BatBalance() = default;
~BatBalance() = default;

void getWalletProperties(const std::string& paymentInfo, braveledger_bat_helper::FetchCallback callback,
const braveledger_bat_helper::FETCH_CALLBACK_EXTRA_DATA_ST& extraData);

private:
private:
std::string buildURL(const std::string& path, const std::string& prefix);

braveledger_bat_client_webrequest::BatClientWebRequest batClientWebRequest_;
};

} //namespace braveledger_bat_balance
} // namespace braveledger_bat_balance

#endif // BRAVELEDGER_BAT_BALANCE_H_
Loading