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

Unified Diff: components/image_fetcher/image_fetcher_impl.h

Issue 2074153002: Pass the ImageDecoder to the ImageFetcher at creation time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments treib@, bauerb@ Created 4 years, 6 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/image_fetcher_impl.h
diff --git a/chrome/browser/search/suggestions/image_fetcher_impl.h b/components/image_fetcher/image_fetcher_impl.h
similarity index 75%
rename from chrome/browser/search/suggestions/image_fetcher_impl.h
rename to components/image_fetcher/image_fetcher_impl.h
index 61aaf042fab052867717eab1ad0162ccd5173d6a..b1653afea41ccb6b2fc6d1fb020ec9ed7dce518a 100644
--- a/chrome/browser/search/suggestions/image_fetcher_impl.h
+++ b/components/image_fetcher/image_fetcher_impl.h
@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_SEARCH_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_
-#define CHROME_BROWSER_SEARCH_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_
+#ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_
+#define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_
#include <map>
+#include <memory>
#include <string>
#include <utility>
#include <vector>
@@ -25,15 +26,20 @@ namespace net {
class URLRequestContextGetter;
}
-// TODO(markusheintz): Move the ImageFetcherImpl to components/image_fetcher
-namespace suggestions {
+namespace image_fetcher {
-// image_fetcher::ImageFetcher implementation.
+// TODO(markusheintz): Once the iOS implementation of the ImageFetcher is
+// removed merge the two classes ImageFetcher and ImageFetcherImpl.
class ImageFetcherImpl : public image_fetcher::ImageFetcher {
public:
- explicit ImageFetcherImpl(net::URLRequestContextGetter* url_request_context);
+ ImageFetcherImpl(
+ std::unique_ptr<image_fetcher::ImageDecoder> image_decoder,
+ net::URLRequestContextGetter* url_request_context);
~ImageFetcherImpl() override;
+ // Sets the |delegate| of the ImageFetcherImpl. The |delegate| has to be alive
+ // during the lifetime of the ImageFetcherImpl object. It is the caller's
+ // responsibility to ensure this.
void SetImageFetcherDelegate(
image_fetcher::ImageFetcherDelegate* delegate) override;
@@ -77,7 +83,7 @@ class ImageFetcherImpl : public image_fetcher::ImageFetcher {
image_fetcher::ImageFetcherDelegate* delegate_;
- net::URLRequestContextGetter* url_request_context_;
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_;
std::unique_ptr<image_fetcher::ImageDecoder> image_decoder_;
@@ -90,6 +96,6 @@ class ImageFetcherImpl : public image_fetcher::ImageFetcher {
DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl);
};
-} // namespace suggestions
+} // namespace image_fetcher
-#endif // CHROME_BROWSER_SEARCH_SUGGESTIONS_IMAGE_FETCHER_IMPL_H_
+#endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698