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

Unified Diff: components/image_fetcher/ios/ios_image_data_fetcher.h

Issue 2652893005: Create the IOSImageDataFetcher (Closed)
Patch Set: Remove virtual Created 3 years, 11 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/image_fetcher/ios/ios_image_data_fetcher.h
diff --git a/components/image_fetcher/ios/ios_image_data_fetcher.h b/components/image_fetcher/ios/ios_image_data_fetcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..5db66889b60a8d6431c903ca0b1ebe92b956df8e
--- /dev/null
+++ b/components/image_fetcher/ios/ios_image_data_fetcher.h
@@ -0,0 +1,35 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_
+#define COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_
+
+#include "components/image_fetcher/image_data_fetcher.h"
+
+namespace image_fetcher {
+
+// Callback that informs of the download of an image encoded in |data|.
+using IOSImageDataFetcherCallback = void (^)(NSData* data);
+
+class IOSImageDataFetcher : public ImageDataFetcher {
Marc Treib 2017/01/25 10:37:55 I don't think inheritance is the right tool here.
blundell 2017/01/25 10:46:46 With the caveat that I'm not close to the details
gambard 2017/01/30 13:37:53 Moving to composition.
+ public:
+ // The TaskRunner is used to eventually decode the image.
+ IOSImageDataFetcher(net::URLRequestContextGetter* url_request_context_getter,
+ const scoped_refptr<base::TaskRunner>& task_runner);
+ ~IOSImageDataFetcher() override;
+
+ // Start downloading the image at the given |image_url|. The |callback| will
+ // be called with the downloaded image, or nil if any error happened or the
+ // http response header is not HTTP_OK (200). If the url is a data URL, the
+ // http response header is considered to be HTTP_OK.
+ void FetchImageDataWebpDecoded(const GURL& image_url,
+ IOSImageDataFetcherCallback callback);
+
+ private:
+ // The task runner used to decode images if necessary.
+ const scoped_refptr<base::TaskRunner> task_runner_;
+};
+} // namespace image_fetcher
+
+#endif // COMPONENTS_IMAGE_FETCHER_IOS_IOS_IMAGE_DATA_FETCHER_H_

Powered by Google App Engine
This is Rietveld 408576698