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_delegate.h" | 9 #include "chrome/browser/bitmap_fetcher_delegate.h" |
10 #include "chrome/browser/image_decoder.h" | 10 #include "chrome/browser/image_decoder.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // |net::LOAD_NORMAL| is appropriate. | 38 // |net::LOAD_NORMAL| is appropriate. |
39 void Start(net::URLRequestContextGetter* request_context, | 39 void Start(net::URLRequestContextGetter* request_context, |
40 const std::string& referrer, | 40 const std::string& referrer, |
41 net::URLRequest::ReferrerPolicy referrer_policy, | 41 net::URLRequest::ReferrerPolicy referrer_policy, |
42 int load_flags); | 42 int load_flags); |
43 | 43 |
44 // Methods inherited from URLFetcherDelegate | 44 // Methods inherited from URLFetcherDelegate |
45 | 45 |
46 // This will be called when the URL has been fetched, successfully or not. | 46 // This will be called when the URL has been fetched, successfully or not. |
47 // Use accessor methods on |source| to get the results. | 47 // Use accessor methods on |source| to get the results. |
48 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 48 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
49 | 49 |
50 // This will be called when some part of the response is read. |current| | 50 // This will be called when some part of the response is read. |current| |
51 // denotes the number of bytes received up to the call, and |total| is the | 51 // denotes the number of bytes received up to the call, and |total| is the |
52 // expected total size of the response (or -1 if not determined). | 52 // expected total size of the response (or -1 if not determined). |
53 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 53 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
54 int64 current, | 54 int64 current, |
55 int64 total) OVERRIDE; | 55 int64 total) override; |
56 | 56 |
57 // Methods inherited from ImageDecoder::Delegate | 57 // Methods inherited from ImageDecoder::Delegate |
58 | 58 |
59 // Called when image is decoded. |decoder| is used to identify the image in | 59 // Called when image is decoded. |decoder| is used to identify the image in |
60 // case of decoding several images simultaneously. This will not be called | 60 // case of decoding several images simultaneously. This will not be called |
61 // on the UI thread. | 61 // on the UI thread. |
62 virtual void OnImageDecoded(const ImageDecoder* decoder, | 62 virtual void OnImageDecoded(const ImageDecoder* decoder, |
63 const SkBitmap& decoded_image) OVERRIDE; | 63 const SkBitmap& decoded_image) override; |
64 | 64 |
65 // Called when decoding image failed. | 65 // Called when decoding image failed. |
66 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE; | 66 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override; |
67 | 67 |
68 private: | 68 private: |
69 // Alerts the delegate that a failure occurred. | 69 // Alerts the delegate that a failure occurred. |
70 void ReportFailure(); | 70 void ReportFailure(); |
71 | 71 |
72 scoped_ptr<net::URLFetcher> url_fetcher_; | 72 scoped_ptr<net::URLFetcher> url_fetcher_; |
73 scoped_refptr<ImageDecoder> image_decoder_; | 73 scoped_refptr<ImageDecoder> image_decoder_; |
74 const GURL url_; | 74 const GURL url_; |
75 BitmapFetcherDelegate* const delegate_; | 75 BitmapFetcherDelegate* const delegate_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); | 77 DISALLOW_COPY_AND_ASSIGN(BitmapFetcher); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace chrome | 80 } // namespace chrome |
81 | 81 |
82 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ | 82 #endif // CHROME_BROWSER_BITMAP_FETCHER_BITMAP_FETCHER_H_ |
OLD | NEW |