| Index: ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
|
| diff --git a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
|
| index aba164ff35f0a32a3f3e079d5696e128d169a32e..3040652d74b8829dd5bc31cfdd7394f4cd2582a1 100644
|
| --- a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
|
| +++ b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
|
| @@ -11,10 +11,12 @@
|
| #include "base/logging.h"
|
| #import "base/mac/foundation_util.h"
|
| #import "base/mac/scoped_nsobject.h"
|
| +#include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/metrics/user_metrics.h"
|
| #include "base/metrics/user_metrics_action.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| +#include "components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h"
|
| #import "ios/chrome/browser/installation_notifier.h"
|
| #import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
|
| #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item.h"
|
| @@ -28,7 +30,7 @@
|
| #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h"
|
| #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_whitelist_manager.h"
|
| #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
|
| -#include "net/url_request/url_request_context_getter.h"
|
| +#include "ios/web/public/web_thread.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "url/gurl.h"
|
|
|
| @@ -50,7 +52,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
|
|
|
| @interface NativeAppsCollectionViewController ()<
|
| SKStoreProductViewControllerDelegate> {
|
| - net::URLRequestContextGetter* _requestContextGetter; // weak
|
| + std::unique_ptr<image_fetcher::IOSImageDataFetcherWrapper> _imageFetcher;
|
| base::scoped_nsobject<NSArray> _nativeAppsInSettings;
|
| BOOL _userDidSomething;
|
| }
|
| @@ -100,7 +102,8 @@ typedef NS_ENUM(NSInteger, ItemType) {
|
| (net::URLRequestContextGetter*)requestContextGetter {
|
| self = [super initWithStyle:CollectionViewControllerStyleAppBar];
|
| if (self) {
|
| - _requestContextGetter = requestContextGetter;
|
| + _imageFetcher = base::MakeUnique<image_fetcher::IOSImageDataFetcherWrapper>(
|
| + requestContextGetter, web::WebThread::GetBlockingPool());
|
| base::RecordAction(base::UserMetricsAction("MobileGALOpenSettings"));
|
| _storeKitLauncher = self;
|
|
|
| @@ -210,17 +213,17 @@ typedef NS_ENUM(NSInteger, ItemType) {
|
| // Fetch the real icon.
|
| base::WeakNSObject<NativeAppsCollectionViewController> weakSelf(self);
|
| id<NativeAppMetadata> metadata = [self nativeAppAtIndex:indexPath.item];
|
| - [metadata
|
| - fetchSmallIconWithContext:_requestContextGetter
|
| - completionBlock:^(UIImage* image) {
|
| - base::scoped_nsobject<NativeAppsCollectionViewController>
|
| - strongSelf([weakSelf retain]);
|
| - if (!image || !strongSelf)
|
| - return;
|
| - appItem.icon = image;
|
| - [strongSelf.get().collectionView
|
| - reloadItemsAtIndexPaths:@[ indexPath ]];
|
| - }];
|
| + [metadata fetchSmallIconWithImageFetcher:_imageFetcher.get()
|
| + completionBlock:^(UIImage* image) {
|
| + base::scoped_nsobject<
|
| + NativeAppsCollectionViewController>
|
| + strongSelf([weakSelf retain]);
|
| + if (!image || !strongSelf)
|
| + return;
|
| + appItem.icon = image;
|
| + [strongSelf.get().collectionView
|
| + reloadItemsAtIndexPaths:@[ indexPath ]];
|
| + }];
|
| }
|
| }
|
|
|
|
|