Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: components/payments/content/payment_manifest_downloader.cc

Issue 2802043002: Use web-app manifest format for Android payment apps. (Closed)
Patch Set: Address java comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/payments/content/payment_manifest_downloader.cc
diff --git a/components/payments/content/payment_manifest_downloader.cc b/components/payments/content/payment_manifest_downloader.cc
index 799769f533683969b352502e065a782265274523..ae3e64de5aa07d4b3108973d8447704d8bd76ce3 100644
--- a/components/payments/content/payment_manifest_downloader.cc
+++ b/components/payments/content/payment_manifest_downloader.cc
@@ -31,19 +31,27 @@ bool IsValidManifestUrl(const GURL& url) {
PaymentManifestDownloader::PaymentManifestDownloader(
const scoped_refptr<net::URLRequestContextGetter>& context,
- const GURL& method_name,
+ const GURL& url,
Delegate* delegate)
: context_(context),
- method_name_(method_name),
+ url_(url),
delegate_(delegate),
is_downloading_http_link_header_(true) {
- DCHECK(IsValidManifestUrl(method_name_));
+ DCHECK(IsValidManifestUrl(url_));
}
PaymentManifestDownloader::~PaymentManifestDownloader() {}
-void PaymentManifestDownloader::Download() {
- InitiateDownload(method_name_, net::URLFetcher::HEAD);
+void PaymentManifestDownloader::DownloadPaymentMethodManifest() {
+ DCHECK(!fetcher_);
+ is_downloading_http_link_header_ = true;
+ InitiateDownload(url_, net::URLFetcher::HEAD);
+}
+
+void PaymentManifestDownloader::DownloadWebAppManifest() {
+ DCHECK(!fetcher_);
+ is_downloading_http_link_header_ = false;
+ InitiateDownload(url_, net::URLFetcher::GET);
}
void PaymentManifestDownloader::InitiateDownload(
@@ -83,11 +91,12 @@ void PaymentManifestDownloader::OnURLFetchComplete(
std::string link_header;
headers->GetNormalizedHeader("link", &link_header);
if (!link_header.empty()) {
- std::string manifest_url;
+ std::string payment_method_manifest_url;
std::unordered_map<std::string, base::Optional<std::string>> params;
for (const auto& value : link_header_util::SplitLinkHeader(link_header)) {
- if (!link_header_util::ParseLinkHeaderValue(value.first, value.second,
- &manifest_url, &params)) {
+ if (!link_header_util::ParseLinkHeaderValue(
+ value.first, value.second, &payment_method_manifest_url,
+ &params)) {
continue;
}
@@ -100,7 +109,7 @@ void PaymentManifestDownloader::OnURLFetchComplete(
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
if (std::find(rel_parts.begin(), rel_parts.end(),
"payment-method-manifest") != rel_parts.end()) {
- InitiateDownload(method_name_.Resolve(manifest_url),
+ InitiateDownload(url_.Resolve(payment_method_manifest_url),
net::URLFetcher::GET);
return;
}

Powered by Google App Engine
This is Rietveld 408576698