Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ |
| 6 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ | 6 #define CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" | 9 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h" |
| 10 #include "chrome/browser/image_decoder.h" | 10 #include "chrome/browser/image_decoder.h" |
| 11 #include "net/url_request/url_fetcher_delegate.h" | 11 #include "net/url_request/url_fetcher_delegate.h" |
| 12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 class URLFetcher; | 17 class URLFetcher; |
| 18 class URLRequestContextGetter; | 18 class URLRequestContextGetter; |
| 19 } // namespace net | 19 } // namespace net |
| 20 | 20 |
| 21 namespace chrome { | 21 namespace chrome { |
| 22 | 22 |
| 23 // Asynchrounously fetches an image from the given URL and returns the | 23 // Asynchrounously fetches an image from the given URL and returns the |
| 24 // decoded Bitmap to the provided BitmapFetcherDelegate. | 24 // decoded Bitmap to the provided BitmapFetcherDelegate. This class is |
| 25 // deprecated and will be removed once crbug.com/<TODO(twellington): fill | |
| 26 // this in once deprecation is approved and bug is created> is resolved. Use | |
| 27 // BitmapBatchFetcher instead. | |
|
Nico
2015/02/18 20:59:17
To me, it seems like a better strategy to me to sw
| |
| 25 class BitmapFetcher : public net::URLFetcherDelegate, | 28 class BitmapFetcher : public net::URLFetcherDelegate, |
| 26 public ImageDecoder::Delegate { | 29 public ImageDecoder::Delegate { |
| 27 public: | 30 public: |
| 28 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate); | 31 BitmapFetcher(const GURL& url, BitmapFetcherDelegate* delegate); |
| 29 ~BitmapFetcher() override; | 32 ~BitmapFetcher() override; |
| 30 | 33 |
| 31 const GURL& url() const { return url_; } | 34 const GURL& url() const { return url_; } |
| 32 | 35 |
| 33 // Start fetching the URL with the fetcher. The delegate is notified | 36 // Start fetching the URL with the fetcher. The delegate is notified |
| 34 // asynchronously when done. Start may be called more than once in some | 37 // asynchronously when done. Start may be called more than once in some |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 scoped_refptr<ImageDecoder> image_decoder_; | 76 scoped_refptr<ImageDecoder> image_decoder_; |
| 74 const GURL url_; | 77 const GURL url_; |
| 75 BitmapFetcherDelegate* const delegate_; | 78 BitmapFetcherDelegate* const delegate_; |
| 76 | 79 |
| 77 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); | 80 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace chrome | 83 } // namespace chrome |
| 81 | 84 |
| 82 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ | 85 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ |
| OLD | NEW |