Commit b32c2fcc authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment] Log CanMakePaymentResponsePtr in Dev Tools

Before this patch, Dev Tools logged only the |can_make_payment| field of
CanMakePaymentResponsePtr struct, making web developer's debugging
experience difficult.

This patch logs all of the fields of the CanMakePaymentResponsePtr
struct in Dev Tools, given that
chrome://flags/#enable-web-payments-minimal-ui flag is enabled.

After this patch, web developers can easily inspect the "canmakepayment"
response from a payment handler in Dev Tools.

Bug: 1005076
Change-Id: Ifa0456bc14c59c704baba1c6fe082972b15c7058
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091648
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749620}
parent 2edba795
......@@ -681,15 +681,23 @@ void OnResponseForCanMakePaymentOnUiThread(
CanMakePaymentEventResponseType::INVALID_ACCOUNT_BALANCE_VALUE);
}
// TODO(rouslan): Log |ready_for_minimal_ui| and |account_balance| in Dev
// Tools.
auto* dev_tools = GetDevToolsForInstanceGroup(instance_group, sw_origin);
if (dev_tools) {
std::stringstream response_type;
response_type << response->response_type;
std::map<std::string, std::string> data = {
{"Type", response_type.str()},
{"Can Make Payment", response->can_make_payment ? "true" : "false"}};
if (base::FeatureList::IsEnabled(features::kWebPaymentsMinimalUI)) {
data["Ready for Minimal UI"] =
response->ready_for_minimal_ui ? "true" : "false";
data["Account Balance"] =
response->account_balance ? *response->account_balance : "";
}
dev_tools->LogBackgroundServiceEvent(
registration_id, sw_origin, DevToolsBackgroundService::kPaymentHandler,
"Can make payment response",
/*instance_id=*/payment_request_id,
{{"Can Make Payment", response->can_make_payment ? "true" : "false"}});
/*instance_id=*/payment_request_id, data);
}
std::move(callback).Run(std::move(response));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment