OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_ |
| 6 #define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 13 #include "content/public/common/manifest.h" |
| 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 |
| 16 namespace content { |
| 17 |
| 18 class PaymentAppInfoFetcher |
| 19 : public base::RefCountedThreadSafe<PaymentAppInfoFetcher> { |
| 20 public: |
| 21 PaymentAppInfoFetcher(); |
| 22 |
| 23 using PaymentAppInfoFetchCallback = |
| 24 base::OnceCallback<void(const std::string&, const std::string&)>; |
| 25 void Start(const GURL& context_url, |
| 26 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context, |
| 27 PaymentAppInfoFetchCallback callback); |
| 28 |
| 29 private: |
| 30 friend class base::RefCountedThreadSafe<PaymentAppInfoFetcher>; |
| 31 ~PaymentAppInfoFetcher(); |
| 32 |
| 33 void StartFromUIThread( |
| 34 const std::unique_ptr<std::vector<std::pair<int, int>>>& provider_hosts); |
| 35 |
| 36 // The WebContents::GetManifestCallback. |
| 37 void FetchPaymentAppManifestCallback(const GURL& url, |
| 38 const Manifest& manifest); |
| 39 |
| 40 // The ManifestIconDownloader::IconFetchCallback. |
| 41 void OnIconFetched(const SkBitmap& icon); |
| 42 void PostPaymentAppInfoFetchResultToIOThread(); |
| 43 |
| 44 GURL context_url_; |
| 45 PaymentAppInfoFetchCallback callback_; |
| 46 |
| 47 int context_process_id_; |
| 48 int context_frame_id_; |
| 49 std::string fetched_payment_app_name_; |
| 50 std::string fetched_payment_app_icon_; |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(PaymentAppInfoFetcher); |
| 53 }; |
| 54 |
| 55 } // namespace content |
| 56 |
| 57 #endif // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_INFO_FETCHER_H_ |
OLD | NEW |