Use ExtensionFunction::args() instead of accessing its private members

Chromium change:

https://source.chromium.org/chromium/chromium/src/+/a6dba25659702847866ae636d6e334cb4096c4dc

commit a6dba25659702847866ae636d6e334cb4096c4dc
Author: Alex Turner <alexmt@chromium.org>
Date:   Wed Aug 18 01:29:05 2021 +0000

    Move args_ to private in ExtensionFunction

    Following the change in crrev.com/c/3066527, ExtensionFunction now
    provides the protected methods has_args() and args(). We can therefore
    now make args_ private. This requires converting a large number of
    `Params::Create(*args_)` calls to `Params::Create(args())`.

    Bug: 1187062
This commit is contained in:
Mario Sanchez Prada
2021-10-05 16:19:51 -04:00
committed by mkarolin
parent 0c9226986c
commit 86ea5a4a01
11 changed files with 72 additions and 73 deletions
+3 -3
View File
@@ -128,7 +128,7 @@ BinanceGetConvertQuoteFunction::Run() {
}
std::unique_ptr<binance::GetConvertQuote::Params> params(
binance::GetConvertQuote::Params::Create(*args_));
binance::GetConvertQuote::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetBinanceService(browser_context());
@@ -175,7 +175,7 @@ BinanceGetDepositInfoFunction::Run() {
}
std::unique_ptr<binance::GetDepositInfo::Params> params(
binance::GetDepositInfo::Params::Create(*args_));
binance::GetDepositInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetBinanceService(browser_context());
@@ -206,7 +206,7 @@ BinanceConfirmConvertFunction::Run() {
}
std::unique_ptr<binance::ConfirmConvert::Params> params(
binance::ConfirmConvert::Params::Create(*args_));
binance::ConfirmConvert::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetBinanceService(browser_context());
+25 -26
View File
@@ -51,7 +51,7 @@ BraveRewardsOpenBrowserActionUIFunction::
ExtensionFunction::ResponseAction
BraveRewardsOpenBrowserActionUIFunction::Run() {
std::unique_ptr<brave_rewards::OpenBrowserActionUI::Params> params(
brave_rewards::OpenBrowserActionUI::Params::Create(*args_));
brave_rewards::OpenBrowserActionUI::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* profile = Profile::FromBrowserContext(browser_context());
@@ -88,7 +88,7 @@ BraveRewardsUpdateMediaDurationFunction::
ExtensionFunction::ResponseAction
BraveRewardsUpdateMediaDurationFunction::Run() {
std::unique_ptr<brave_rewards::UpdateMediaDuration::Params> params(
brave_rewards::UpdateMediaDuration::Params::Create(*args_));
brave_rewards::UpdateMediaDuration::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
@@ -115,7 +115,7 @@ BraveRewardsGetPublisherInfoFunction::
ExtensionFunction::ResponseAction
BraveRewardsGetPublisherInfoFunction::Run() {
std::unique_ptr<brave_rewards::GetPublisherInfo::Params> params(
brave_rewards::GetPublisherInfo::Params::Create(*args_));
brave_rewards::GetPublisherInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
@@ -162,7 +162,7 @@ BraveRewardsGetPublisherPanelInfoFunction::
ExtensionFunction::ResponseAction
BraveRewardsGetPublisherPanelInfoFunction::Run() {
std::unique_ptr<brave_rewards::GetPublisherPanelInfo::Params> params(
brave_rewards::GetPublisherPanelInfo::Params::Create(*args_));
brave_rewards::GetPublisherPanelInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
@@ -209,9 +209,8 @@ BraveRewardsSavePublisherInfoFunction::
ExtensionFunction::ResponseAction
BraveRewardsSavePublisherInfoFunction::Run() {
std::unique_ptr<brave_rewards::SavePublisherInfo::Params>
params(brave_rewards::SavePublisherInfo::Params::Create(
*args_));
std::unique_ptr<brave_rewards::SavePublisherInfo::Params> params(
brave_rewards::SavePublisherInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
@@ -247,7 +246,7 @@ BraveRewardsTipSiteFunction::~BraveRewardsTipSiteFunction() {
ExtensionFunction::ResponseAction BraveRewardsTipSiteFunction::Run() {
std::unique_ptr<brave_rewards::TipSite::Params> params(
brave_rewards::TipSite::Params::Create(*args_));
brave_rewards::TipSite::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Sanity check: don't allow tips in private / tor contexts,
@@ -285,7 +284,7 @@ BraveRewardsTipUserFunction::~BraveRewardsTipUserFunction() {
ExtensionFunction::ResponseAction BraveRewardsTipUserFunction::Run() {
std::unique_ptr<brave_rewards::TipUser::Params> params(
brave_rewards::TipUser::Params::Create(*args_));
brave_rewards::TipUser::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Sanity check: don't allow tips in private / tor contexts,
@@ -350,7 +349,7 @@ void BraveRewardsTipUserFunction::OnTipUserGetPublisherInfo(
}
std::unique_ptr<brave_rewards::TipUser::Params> params(
brave_rewards::TipUser::Params::Create(*args_));
brave_rewards::TipUser::Params::Create(args()));
auto publisher_info = ledger::type::PublisherInfo::New();
publisher_info->id = params->publisher_key;
@@ -385,7 +384,7 @@ void BraveRewardsTipUserFunction::OnTipUserSavePublisherInfo(
void BraveRewardsTipUserFunction::ShowTipDialog() {
std::unique_ptr<brave_rewards::TipUser::Params> params(
brave_rewards::TipUser::Params::Create(*args_));
brave_rewards::TipUser::Params::Create(args()));
if (!params) {
Release();
return;
@@ -434,7 +433,7 @@ BraveRewardsIncludeInAutoContributionFunction::
ExtensionFunction::ResponseAction
BraveRewardsIncludeInAutoContributionFunction::Run() {
std::unique_ptr<brave_rewards::IncludeInAutoContribution::Params> params(
brave_rewards::IncludeInAutoContribution::Params::Create(*args_));
brave_rewards::IncludeInAutoContribution::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
RewardsServiceFactory::GetForProfile(profile);
@@ -448,7 +447,7 @@ ExtensionFunction::ResponseAction
ExtensionFunction::ResponseAction BraveRewardsGetPublisherDataFunction::Run() {
std::unique_ptr<brave_rewards::GetPublisherData::Params> params(
brave_rewards::GetPublisherData::Params::Create(*args_));
brave_rewards::GetPublisherData::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
auto* rewards_service = RewardsServiceFactory::GetForProfile(profile);
if (rewards_service) {
@@ -514,7 +513,7 @@ ExtensionFunction::ResponseAction BraveRewardsGetBalanceReportFunction::Run() {
}
std::unique_ptr<brave_rewards::GetBalanceReport::Params> params(
brave_rewards::GetBalanceReport::Params::Create(*args_));
brave_rewards::GetBalanceReport::Params::Create(args()));
rewards_service->GetBalanceReport(
params->month,
@@ -559,7 +558,7 @@ BraveRewardsClaimPromotionFunction::
ExtensionFunction::ResponseAction BraveRewardsClaimPromotionFunction::Run() {
std::unique_ptr<brave_rewards::ClaimPromotion::Params> params(
brave_rewards::ClaimPromotion::Params::Create(*args_));
brave_rewards::ClaimPromotion::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
RewardsServiceFactory::GetForProfile(profile);
@@ -598,7 +597,7 @@ BraveRewardsAttestPromotionFunction::
ExtensionFunction::ResponseAction BraveRewardsAttestPromotionFunction::Run() {
std::unique_ptr<brave_rewards::AttestPromotion::Params> params(
brave_rewards::AttestPromotion::Params::Create(*args_));
brave_rewards::AttestPromotion::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
RewardsServiceFactory::GetForProfile(profile);
@@ -663,7 +662,7 @@ BraveRewardsSaveAdsSettingFunction::~BraveRewardsSaveAdsSettingFunction() {
ExtensionFunction::ResponseAction BraveRewardsSaveAdsSettingFunction::Run() {
std::unique_ptr<brave_rewards::SaveAdsSetting::Params> params(
brave_rewards::SaveAdsSetting::Params::Create(*args_));
brave_rewards::SaveAdsSetting::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
RewardsServiceFactory::GetForProfile(profile);
@@ -689,7 +688,7 @@ BraveRewardsSetAutoContributeEnabledFunction::
ExtensionFunction::ResponseAction
BraveRewardsSetAutoContributeEnabledFunction::Run() {
std::unique_ptr<brave_rewards::SetAutoContributeEnabled::Params> params(
brave_rewards::SetAutoContributeEnabled::Params::Create(*args_));
brave_rewards::SetAutoContributeEnabled::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
RewardsServiceFactory::GetForProfile(profile);
@@ -733,7 +732,7 @@ BraveRewardsSaveRecurringTipFunction::
ExtensionFunction::ResponseAction
BraveRewardsSaveRecurringTipFunction::Run() {
std::unique_ptr<brave_rewards::SaveRecurringTip::Params> params(
brave_rewards::SaveRecurringTip::Params::Create(*args_));
brave_rewards::SaveRecurringTip::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service_ =
@@ -764,7 +763,7 @@ BraveRewardsRemoveRecurringTipFunction::
ExtensionFunction::ResponseAction
BraveRewardsRemoveRecurringTipFunction::Run() {
std::unique_ptr<brave_rewards::RemoveRecurringTip::Params> params(
brave_rewards::RemoveRecurringTip::Params::Create(*args_));
brave_rewards::RemoveRecurringTip::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service_ =
@@ -821,7 +820,7 @@ BraveRewardsGetPublisherBannerFunction::
ExtensionFunction::ResponseAction
BraveRewardsGetPublisherBannerFunction::Run() {
std::unique_ptr<brave_rewards::GetPublisherBanner::Params> params(
brave_rewards::GetPublisherBanner::Params::Create(*args_));
brave_rewards::GetPublisherBanner::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
@@ -874,7 +873,7 @@ BraveRewardsRefreshPublisherFunction::~BraveRewardsRefreshPublisherFunction() {
ExtensionFunction::ResponseAction BraveRewardsRefreshPublisherFunction::Run() {
std::unique_ptr<brave_rewards::RefreshPublisher::Params> params(
brave_rewards::RefreshPublisher::Params::Create(*args_));
brave_rewards::RefreshPublisher::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
@@ -942,7 +941,7 @@ ExtensionFunction::ResponseAction
BraveRewardsGetInlineTippingPlatformEnabledFunction::Run() {
std::unique_ptr<brave_rewards::GetInlineTippingPlatformEnabled::Params>
params(brave_rewards::GetInlineTippingPlatformEnabled::Params::Create(
*args_));
args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsService* rewards_service =
@@ -1232,7 +1231,7 @@ ExtensionFunction::ResponseAction
BraveRewardsUpdateScheduledCaptchaResultFunction::Run() {
#if BUILDFLAG(BRAVE_ADAPTIVE_CAPTCHA_ENABLED)
auto params(
brave_rewards::UpdateScheduledCaptchaResult::Params::Create(*args_));
brave_rewards::UpdateScheduledCaptchaResult::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
@@ -1306,7 +1305,7 @@ void BraveRewardsGetPrefsFunction::GetAutoContributePropertiesCallback(
BraveRewardsUpdatePrefsFunction::~BraveRewardsUpdatePrefsFunction() = default;
ExtensionFunction::ResponseAction BraveRewardsUpdatePrefsFunction::Run() {
auto params = brave_rewards::UpdatePrefs::Params::Create(*args_);
auto params = brave_rewards::UpdatePrefs::Params::Create(args());
EXTENSION_FUNCTION_VALIDATE(params);
auto* profile = Profile::FromBrowserContext(browser_context());
@@ -1342,7 +1341,7 @@ BraveRewardsRequestAdsEnabledPopupClosedFunction::
ExtensionFunction::ResponseAction
BraveRewardsRequestAdsEnabledPopupClosedFunction::Run() {
auto params(
brave_rewards::RequestAdsEnabledPopupClosed::Params::Create(*args_));
brave_rewards::RequestAdsEnabledPopupClosed::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
Profile* profile = Profile::FromBrowserContext(browser_context());
+19 -19
View File
@@ -48,7 +48,7 @@ const char kInvalidControlTypeError[] = "Invalid ControlType.";
ExtensionFunction::ResponseAction
BraveShieldsAddSiteCosmeticFilterFunction::Run() {
std::unique_ptr<brave_shields::AddSiteCosmeticFilter::Params> params(
brave_shields::AddSiteCosmeticFilter::Params::Create(*args_));
brave_shields::AddSiteCosmeticFilter::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* custom_filters_service =
@@ -73,7 +73,7 @@ BraveShieldsOpenFilterManagementPageFunction::Run() {
ExtensionFunction::ResponseAction BraveShieldsAllowScriptsOnceFunction::Run() {
std::unique_ptr<brave_shields::AllowScriptsOnce::Params> params(
brave_shields::AllowScriptsOnce::Params::Create(*args_));
brave_shields::AllowScriptsOnce::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Get web contents for this tab
@@ -98,7 +98,7 @@ BraveShieldsOpenBrowserActionUIFunction::
ExtensionFunction::ResponseAction
BraveShieldsOpenBrowserActionUIFunction::Run() {
std::unique_ptr<brave_shields::OpenBrowserActionUI::Params> params(
brave_shields::OpenBrowserActionUI::Params::Create(*args_));
brave_shields::OpenBrowserActionUI::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
std::string error;
if (!BraveActionAPI::ShowActionUI(this,
@@ -113,7 +113,7 @@ BraveShieldsOpenBrowserActionUIFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetBraveShieldsEnabledFunction::Run() {
std::unique_ptr<brave_shields::SetBraveShieldsEnabled::Params> params(
brave_shields::SetBraveShieldsEnabled::Params::Create(*args_));
brave_shields::SetBraveShieldsEnabled::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -135,7 +135,7 @@ BraveShieldsSetBraveShieldsEnabledFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsGetBraveShieldsEnabledFunction::Run() {
std::unique_ptr<brave_shields::GetBraveShieldsEnabled::Params> params(
brave_shields::GetBraveShieldsEnabled::Params::Create(*args_));
brave_shields::GetBraveShieldsEnabled::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -155,8 +155,8 @@ BraveShieldsGetBraveShieldsEnabledFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetCosmeticFilteringControlTypeFunction::Run() {
std::unique_ptr<brave_shields::SetCosmeticFilteringControlType::Params>
params(
brave_shields::SetCosmeticFilteringControlType::Params::Create(*args_));
params(brave_shields::SetCosmeticFilteringControlType::Params::Create(
args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -185,7 +185,7 @@ BraveShieldsIsFirstPartyCosmeticFilteringEnabledFunction::Run() {
std::unique_ptr<brave_shields::IsFirstPartyCosmeticFilteringEnabled::Params>
params(
brave_shields::IsFirstPartyCosmeticFilteringEnabled::Params::Create(
*args_));
args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -203,7 +203,7 @@ BraveShieldsIsFirstPartyCosmeticFilteringEnabledFunction::Run() {
ExtensionFunction::ResponseAction BraveShieldsSetAdControlTypeFunction::Run() {
std::unique_ptr<brave_shields::SetAdControlType::Params> params(
brave_shields::SetAdControlType::Params::Create(*args_));
brave_shields::SetAdControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -229,7 +229,7 @@ ExtensionFunction::ResponseAction BraveShieldsSetAdControlTypeFunction::Run() {
ExtensionFunction::ResponseAction BraveShieldsGetAdControlTypeFunction::Run() {
std::unique_ptr<brave_shields::GetAdControlType::Params> params(
brave_shields::GetAdControlType::Params::Create(*args_));
brave_shields::GetAdControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -249,7 +249,7 @@ ExtensionFunction::ResponseAction BraveShieldsGetAdControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetCookieControlTypeFunction::Run() {
std::unique_ptr<brave_shields::SetCookieControlType::Params> params(
brave_shields::SetCookieControlType::Params::Create(*args_));
brave_shields::SetCookieControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -276,7 +276,7 @@ BraveShieldsSetCookieControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsGetCookieControlTypeFunction::Run() {
std::unique_ptr<brave_shields::GetCookieControlType::Params> params(
brave_shields::GetCookieControlType::Params::Create(*args_));
brave_shields::GetCookieControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -296,7 +296,7 @@ BraveShieldsGetCookieControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetFingerprintingControlTypeFunction::Run() {
std::unique_ptr<brave_shields::SetFingerprintingControlType::Params> params(
brave_shields::SetFingerprintingControlType::Params::Create(*args_));
brave_shields::SetFingerprintingControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -323,7 +323,7 @@ BraveShieldsSetFingerprintingControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsGetFingerprintingControlTypeFunction::Run() {
std::unique_ptr<brave_shields::GetFingerprintingControlType::Params> params(
brave_shields::GetFingerprintingControlType::Params::Create(*args_));
brave_shields::GetFingerprintingControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -343,7 +343,7 @@ BraveShieldsGetFingerprintingControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetHTTPSEverywhereEnabledFunction::Run() {
std::unique_ptr<brave_shields::SetHTTPSEverywhereEnabled::Params> params(
brave_shields::SetHTTPSEverywhereEnabled::Params::Create(*args_));
brave_shields::SetHTTPSEverywhereEnabled::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -365,7 +365,7 @@ BraveShieldsSetHTTPSEverywhereEnabledFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsGetHTTPSEverywhereEnabledFunction::Run() {
std::unique_ptr<brave_shields::GetHTTPSEverywhereEnabled::Params> params(
brave_shields::GetHTTPSEverywhereEnabled::Params::Create(*args_));
brave_shields::GetHTTPSEverywhereEnabled::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -385,7 +385,7 @@ BraveShieldsGetHTTPSEverywhereEnabledFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsSetNoScriptControlTypeFunction::Run() {
std::unique_ptr<brave_shields::SetNoScriptControlType::Params> params(
brave_shields::SetNoScriptControlType::Params::Create(*args_));
brave_shields::SetNoScriptControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -412,7 +412,7 @@ BraveShieldsSetNoScriptControlTypeFunction::Run() {
ExtensionFunction::ResponseAction
BraveShieldsGetNoScriptControlTypeFunction::Run() {
std::unique_ptr<brave_shields::GetNoScriptControlType::Params> params(
brave_shields::GetNoScriptControlType::Params::Create(*args_));
brave_shields::GetNoScriptControlType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
const GURL url(params->url);
@@ -438,7 +438,7 @@ BraveShieldsOnShieldsPanelShownFunction::Run() {
ExtensionFunction::ResponseAction BraveShieldsReportBrokenSiteFunction::Run() {
std::unique_ptr<brave_shields::ReportBrokenSite::Params> params(
brave_shields::ReportBrokenSite::Params::Create(*args_));
brave_shields::ReportBrokenSite::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
// Get web contents for this tab
+1 -1
View File
@@ -31,7 +31,7 @@ ExtensionFunction::ResponseAction BraveThemeGetBraveThemeTypeFunction::Run() {
ExtensionFunction::ResponseAction BraveThemeSetBraveThemeTypeFunction::Run() {
std::unique_ptr<brave_theme::SetBraveThemeType::Params> params(
brave_theme::SetBraveThemeType::Params::Create(*args_));
brave_theme::SetBraveThemeType::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
dark_mode::SetBraveDarkModeType(params->type);
+2 -2
View File
@@ -116,7 +116,7 @@ ExtensionFunction::ResponseAction
BraveWalletGetWalletSeedFunction::Run() {
// make sure the passed in enryption key is 32 bytes.
std::unique_ptr<brave_wallet::GetWalletSeed::Params> params(
brave_wallet::GetWalletSeed::Params::Create(*args_));
brave_wallet::GetWalletSeed::Params::Create(args()));
if (params->key.size() != 32) {
return RespondNow(Error("Invalid input key size"));
}
@@ -139,7 +139,7 @@ ExtensionFunction::ResponseAction
BraveWalletGetBitGoSeedFunction::Run() {
// make sure the passed in enryption key is 32 bytes.
std::unique_ptr<brave_wallet::GetBitGoSeed::Params> params(
brave_wallet::GetBitGoSeed::Params::Create(*args_));
brave_wallet::GetBitGoSeed::Params::Create(args()));
if (params->key.size() != 32) {
return RespondNow(Error("Invalid input key size"));
}
+2 -2
View File
@@ -46,7 +46,7 @@ CryptoDotComGetTickerInfoFunction::Run() {
}
std::unique_ptr<crypto_dot_com::GetTickerInfo::Params> params(
crypto_dot_com::GetTickerInfo::Params::Create(*args_));
crypto_dot_com::GetTickerInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetCryptoDotComService(browser_context());
@@ -81,7 +81,7 @@ CryptoDotComGetChartDataFunction::Run() {
}
std::unique_ptr<crypto_dot_com::GetChartData::Params> params(
crypto_dot_com::GetChartData::Params::Create(*args_));
crypto_dot_com::GetChartData::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetCryptoDotComService(browser_context());
+5 -5
View File
@@ -73,7 +73,7 @@ ExtensionFunction::ResponseAction FtxGetChartDataFunction::Run() {
}
std::unique_ptr<ftx::GetChartData::Params> params(
ftx::GetChartData::Params::Create(*args_));
ftx::GetChartData::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool data_request = service->GetChartData(
@@ -108,7 +108,7 @@ ExtensionFunction::ResponseAction FtxSetOauthHostFunction::Run() {
}
std::unique_ptr<ftx::SetOauthHost::Params> params(
ftx::SetOauthHost::Params::Create(*args_));
ftx::SetOauthHost::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
if (params->host != "ftx.us" && params->host != "ftx.com") {
@@ -197,7 +197,7 @@ ExtensionFunction::ResponseAction FtxGetConvertQuoteFunction::Run() {
}
std::unique_ptr<ftx::GetConvertQuote::Params> params(
ftx::GetConvertQuote::Params::Create(*args_));
ftx::GetConvertQuote::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool data_request = service->GetConvertQuote(
@@ -222,7 +222,7 @@ ExtensionFunction::ResponseAction FtxGetConvertQuoteInfoFunction::Run() {
}
std::unique_ptr<ftx::GetConvertQuoteInfo::Params> params(
ftx::GetConvertQuoteInfo::Params::Create(*args_));
ftx::GetConvertQuoteInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool data_request = service->GetConvertQuoteInfo(
@@ -254,7 +254,7 @@ ExtensionFunction::ResponseAction FtxExecuteConvertQuoteFunction::Run() {
}
std::unique_ptr<ftx::ExecuteConvertQuote::Params> params(
ftx::ExecuteConvertQuote::Params::Create(*args_));
ftx::ExecuteConvertQuote::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool data_request = service->ExecuteConvertQuote(
+4 -4
View File
@@ -80,7 +80,7 @@ void GeminiRefreshAccessTokenFunction::OnRefreshResult(bool success) {
ExtensionFunction::ResponseAction
GeminiGetTickerPriceFunction::Run() {
std::unique_ptr<gemini::GetTickerPrice::Params> params(
gemini::GetTickerPrice::Params::Create(*args_));
gemini::GetTickerPrice::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetGeminiService(browser_context());
@@ -132,7 +132,7 @@ void GeminiGetAccountBalancesFunction::OnGetAccountBalances(
ExtensionFunction::ResponseAction
GeminiGetDepositInfoFunction::Run() {
std::unique_ptr<gemini::GetDepositInfo::Params> params(
gemini::GetDepositInfo::Params::Create(*args_));
gemini::GetDepositInfo::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetGeminiService(browser_context());
@@ -174,7 +174,7 @@ void GeminiRevokeTokenFunction::OnRevokeToken(bool success) {
ExtensionFunction::ResponseAction
GeminiGetOrderQuoteFunction::Run() {
std::unique_ptr<gemini::GetOrderQuote::Params> params(
gemini::GetOrderQuote::Params::Create(*args_));
gemini::GetOrderQuote::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetGeminiService(browser_context());
@@ -207,7 +207,7 @@ void GeminiGetOrderQuoteFunction::OnOrderQuoteResult(
ExtensionFunction::ResponseAction
GeminiExecuteOrderFunction::Run() {
std::unique_ptr<gemini::ExecuteOrder::Params> params(
gemini::ExecuteOrder::Params::Create(*args_));
gemini::ExecuteOrder::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
auto* service = GetGeminiService(browser_context());
+1 -1
View File
@@ -26,7 +26,7 @@ GreaselionIsGreaselionExtensionFunction::Run() {
}
std::unique_ptr<greaselion::IsGreaselionExtension::Params> params(
greaselion::IsGreaselionExtension::Params::Create(*args_));
greaselion::IsGreaselionExtension::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
bool result = greaselion_service->IsGreaselionExtension(params->id);
+7 -7
View File
@@ -97,7 +97,7 @@ ExtensionFunction::ResponseAction IpfsRemoveIpfsPeerFunction::Run() {
return RespondNow(Error("Could not obtain IPFS service"));
}
std::unique_ptr<ipfs::RemoveIpfsPeer::Params> params(
ipfs::RemoveIpfsPeer::Params::Create(*args_));
ipfs::RemoveIpfsPeer::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
ipfs_service->GetConfig(
base::BindOnce(&IpfsRemoveIpfsPeerFunction::OnConfigLoaded,
@@ -143,7 +143,7 @@ ExtensionFunction::ResponseAction IpfsAddIpfsPeerFunction::Run() {
return RespondNow(Error("Could not obtain IPFS service"));
}
std::unique_ptr<ipfs::AddIpfsPeer::Params> params(
ipfs::AddIpfsPeer::Params::Create(*args_));
ipfs::AddIpfsPeer::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
ipfs_service->GetConfig(
base::BindOnce(&IpfsAddIpfsPeerFunction::OnConfigLoaded,
@@ -218,7 +218,7 @@ ExtensionFunction::ResponseAction IpfsRemoveIpnsKeyFunction::Run() {
return RespondNow(Error("IPFS node is not launched"));
}
std::unique_ptr<ipfs::RemoveIpnsKey::Params> params(
ipfs::RemoveIpnsKey::Params::Create(*args_));
ipfs::RemoveIpnsKey::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
key_manager->RemoveKey(
params->name, base::BindOnce(&IpfsRemoveIpnsKeyFunction::OnKeyRemoved,
@@ -244,7 +244,7 @@ ExtensionFunction::ResponseAction IpfsRotateKeyFunction::Run() {
return RespondNow(Error("Could not obtain IPFS service"));
}
std::unique_ptr<ipfs::RotateKey::Params> params(
ipfs::RotateKey::Params::Create(*args_));
ipfs::RotateKey::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
ipfs_service->RotateKey(params->name,
base::BindOnce(&IpfsRotateKeyFunction::OnKeyRotated,
@@ -268,7 +268,7 @@ ExtensionFunction::ResponseAction IpfsAddIpnsKeyFunction::Run() {
return RespondNow(Error("IPFS node is not launched"));
}
std::unique_ptr<ipfs::AddIpnsKey::Params> params(
ipfs::AddIpnsKey::Params::Create(*args_));
ipfs::AddIpnsKey::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
key_manager->GenerateNewKey(
params->name, base::BindOnce(&IpfsAddIpnsKeyFunction::OnKeyCreated,
@@ -432,7 +432,7 @@ ExtensionFunction::ResponseAction IpfsResolveIPFSURIFunction::Run() {
}
std::unique_ptr<ipfs::ResolveIPFSURI::Params> params(
ipfs::ResolveIPFSURI::Params::Create(*args_));
ipfs::ResolveIPFSURI::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
GURL uri(params->uri);
GURL ipfs_gateway_url;
@@ -454,7 +454,7 @@ ExtensionFunction::ResponseAction IpfsValidateGatewayUrlFunction::Run() {
return RespondNow(Error("Could not obtain IPFS service"));
}
std::unique_ptr<ipfs::ValidateGatewayUrl::Params> params(
ipfs::ValidateGatewayUrl::Params::Create(*args_));
ipfs::ValidateGatewayUrl::Params::Create(args()));
EXTENSION_FUNCTION_VALIDATE(params.get());
ipfs_service->ValidateGateway(
@@ -26,7 +26,7 @@ RewardsNotificationsAddNotificationFunction::
ExtensionFunction::ResponseAction
RewardsNotificationsAddNotificationFunction::Run() {
std::unique_ptr<rewards_notifications::AddNotification::Params> params(
rewards_notifications::AddNotification::Params::Create(*args_));
rewards_notifications::AddNotification::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsNotificationService* rewards_notification_service =
RewardsServiceFactory::GetForProfile(profile)->GetNotificationService();
@@ -45,7 +45,7 @@ RewardsNotificationsDeleteNotificationFunction::
ExtensionFunction::ResponseAction
RewardsNotificationsDeleteNotificationFunction::Run() {
std::unique_ptr<rewards_notifications::DeleteNotification::Params> params(
rewards_notifications::DeleteNotification::Params::Create(*args_));
rewards_notifications::DeleteNotification::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsNotificationService* rewards_notification_service =
RewardsServiceFactory::GetForProfile(profile)->GetNotificationService();
@@ -77,7 +77,7 @@ RewardsNotificationsGetNotificationFunction::
ExtensionFunction::ResponseAction
RewardsNotificationsGetNotificationFunction::Run() {
std::unique_ptr<rewards_notifications::GetNotification::Params> params(
rewards_notifications::GetNotification::Params::Create(*args_));
rewards_notifications::GetNotification::Params::Create(args()));
Profile* profile = Profile::FromBrowserContext(browser_context());
RewardsNotificationService* rewards_notification_service =
RewardsServiceFactory::GetForProfile(profile)->GetNotificationService();