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

Unified Diff: components/image_fetcher/image_data_fetcher.h

Issue 2073753002: Simplify the ImageDataFetcher code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to tot 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
« no previous file with comments | « no previous file | components/image_fetcher/image_data_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/image_fetcher/image_data_fetcher.h
diff --git a/components/image_fetcher/image_data_fetcher.h b/components/image_fetcher/image_data_fetcher.h
index c503db85b506b399bf224d66fe90dede1de3d777..bd476ef09f0824fa3076a76430805ef6c9571857 100644
--- a/components/image_fetcher/image_data_fetcher.h
+++ b/components/image_fetcher/image_data_fetcher.h
@@ -12,22 +12,24 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "net/url_request/url_fetcher_delegate.h"
#include "url/gurl.h"
namespace net {
+class URLFetcher;
class URLRequestContextGetter;
} // namespace net
namespace image_fetcher {
-class ImageDataFetcher {
+class ImageDataFetcher : public net::URLFetcherDelegate {
public:
using ImageDataFetcherCallback =
base::Callback<void(const std::string& image_data)>;
explicit ImageDataFetcher(
net::URLRequestContextGetter* url_request_context_getter);
- ~ImageDataFetcher();
+ ~ImageDataFetcher() override;
// Fetches the raw image bytes from the given |image_url| and calls the given
// |callback|. The callback is run even if fetching the URL fails. In case
@@ -36,14 +38,13 @@ class ImageDataFetcher {
const ImageDataFetcherCallback& callback);
private:
- class ImageDataFetcherRequest;
+ struct ImageDataFetcherRequest;
- // Removes the ImageDataFetcherRequest for the given |image_url| from the
- // internal request queue.
- void RemoveImageDataFetcherRequest(const GURL& image_url);
+ // Method inherited from URLFetcherDelegate
+ void OnURLFetchComplete(const net::URLFetcher* source) override;
// All active image url requests.
- std::map<const GURL, std::unique_ptr<ImageDataFetcherRequest>>
+ std::map<const net::URLFetcher*, std::unique_ptr<ImageDataFetcherRequest>>
pending_requests_;
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
« no previous file with comments | « no previous file | components/image_fetcher/image_data_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698