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

Side by Side Diff: components/image_fetcher/ios/ios_image_data_fetcher_wrapper.h

Issue 2674653003: Use IOSImageDataFetcherWrapper in BrowserViewController (Closed)
Patch Set: Change IOSImageDataFetcherWrapper wrapping Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ 5 #ifndef COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_
6 #define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ 6 #define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_
7 7
8 #import <Foundation/Foundation.h> 8 #import <Foundation/Foundation.h>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 18 matching lines...) Expand all
29 class IOSImageDataFetcherWrapper { 29 class IOSImageDataFetcherWrapper {
30 public: 30 public:
31 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; 31 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName;
32 32
33 // The TaskRunner is used to decode the image if it is WebP-encoded. 33 // The TaskRunner is used to decode the image if it is WebP-encoded.
34 IOSImageDataFetcherWrapper( 34 IOSImageDataFetcherWrapper(
35 net::URLRequestContextGetter* url_request_context_getter, 35 net::URLRequestContextGetter* url_request_context_getter,
36 const scoped_refptr<base::TaskRunner>& task_runner); 36 const scoped_refptr<base::TaskRunner>& task_runner);
37 virtual ~IOSImageDataFetcherWrapper(); 37 virtual ~IOSImageDataFetcherWrapper();
38 38
39 // Start downloading the image at the given |image_url|. The |callback| will 39 // Helper to start downloading and possibly decoding the image without a
40 // be called with the downloaded image, or nil if any error happened or the 40 // referrer.
41 // http response header is not HTTP_OK (200). If the url is a data URL, the
42 // http response header is considered to be HTTP_OK.
43 // |callback| cannot be nil.
44 virtual void FetchImageDataWebpDecoded(const GURL& image_url, 41 virtual void FetchImageDataWebpDecoded(const GURL& image_url,
45 IOSImageDataFetcherCallback callback); 42 IOSImageDataFetcherCallback callback);
46 43
44 // Start downloading the image at the given |image_url|. The |callback| will
45 // be called with the downloaded image, or nil if any error happened. If the
46 // image is WebP it will be decoded.
47 // The |referrer| and |referrer_policy| will be passed on to the underlying
48 // URLFetcher.
49 // |callback| cannot be nil.
50 void FetchImageDataWebpDecoded(
51 const GURL& image_url,
52 IOSImageDataFetcherCallback callback,
53 const std::string& referrer,
54 net::URLRequest::ReferrerPolicy referrer_policy);
55
47 // Sets a service name against which to track data usage. 56 // Sets a service name against which to track data usage.
48 void SetDataUseServiceName(DataUseServiceName data_use_service_name); 57 void SetDataUseServiceName(DataUseServiceName data_use_service_name);
49 58
50 private: 59 private:
60 ImageDataFetcher::ImageDataFetcherCallback CallbackForImageDataFetcher(
61 IOSImageDataFetcherCallback callback);
62
51 // The task runner used to decode images if necessary. 63 // The task runner used to decode images if necessary.
52 const scoped_refptr<base::TaskRunner> task_runner_; 64 const scoped_refptr<base::TaskRunner> task_runner_;
53 ImageDataFetcher image_data_fetcher_; 65 ImageDataFetcher image_data_fetcher_;
54 66
55 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper); 67 DISALLOW_COPY_AND_ASSIGN(IOSImageDataFetcherWrapper);
56 }; 68 };
57 69
58 } // namespace image_fetcher 70 } // namespace image_fetcher
59 71
60 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_ 72 #endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_WRAPPER_H_
OLDNEW
« no previous file with comments | « components/image_fetcher/image_data_fetcher.cc ('k') | components/image_fetcher/ios/ios_image_data_fetcher_wrapper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698