OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SAFE_IMAGE_FETCHER_H_ | |
6 #define CHROME_BROWSER_SAFE_IMAGE_FETCHER_H_ | |
7 | |
8 #include "base/callback_forward.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/image_decoder.h" | |
11 #include "net/url_request/url_fetcher_delegate.h" | |
12 #include "url/gurl.h" | |
13 | |
14 class SkBitmap; | |
15 | |
16 namespace net { | |
17 class URLFetcher; | |
18 class URLRequestContextGetter; | |
19 } | |
20 | |
21 class SafeImageFetcher : public ImageDecoder::ImageRequest, | |
asargent_no_longer_on_chrome
2015/03/26 18:12:51
nit:
"Every class definition should have an acco
Marc Treib
2015/03/27 11:52:12
Done.
| |
22 public net::URLFetcherDelegate { | |
23 public: | |
24 using GetImageCallback = base::Callback<void(const SkBitmap&)>; | |
25 | |
26 SafeImageFetcher(const GURL& url, | |
27 net::URLRequestContextGetter* context_getter, | |
28 const GetImageCallback& callback); | |
29 ~SafeImageFetcher() override; | |
30 | |
31 private: | |
32 // net::URLFetcherDelegate implementation. | |
33 void OnURLFetchComplete(const net::URLFetcher* source) override; | |
34 | |
35 // ImageDecoder::ImageRequest implementation. | |
36 void OnImageDecoded(const SkBitmap& decoded_image) override; | |
37 void OnDecodeImageFailed() override; | |
38 | |
39 scoped_ptr<net::URLFetcher> url_fetcher_; | |
40 GetImageCallback callback_; | |
41 }; | |
42 | |
43 #endif // CHROME_BROWSER_SAFE_IMAGE_FETCHER_H_ | |
OLD | NEW |