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 COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ |
6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 std::string id; | 69 std::string id; |
70 // Queue for pending callbacks, which may accumulate while the request is in | 70 // Queue for pending callbacks, which may accumulate while the request is in |
71 // flight. | 71 // flight. |
72 CallbackVector callbacks; | 72 CallbackVector callbacks; |
73 }; | 73 }; |
74 | 74 |
75 using ImageRequestMap = std::map<const GURL, ImageRequest>; | 75 using ImageRequestMap = std::map<const GURL, ImageRequest>; |
76 | 76 |
77 // Processes image URL fetched events. This is the continuation method used | 77 // Processes image URL fetched events. This is the continuation method used |
78 // for creating callbacks that are passed to the ImageDataFetcher. | 78 // for creating callbacks that are passed to the ImageDataFetcher. |
79 void OnImageURLFetched(const GURL& image_url, const std::string& image_data); | 79 void OnImageURLFetched(const GURL& image_url, |
| 80 const std::string& image_data, |
| 81 int http_response_code); |
80 | 82 |
81 // Processes image decoded events. This is the continuation method used for | 83 // Processes image decoded events. This is the continuation method used for |
82 // creating callbacks that are passed to the ImageDecoder. | 84 // creating callbacks that are passed to the ImageDecoder. |
83 void OnImageDecoded(const GURL& image_url, const gfx::Image& image); | 85 void OnImageDecoded(const GURL& image_url, const gfx::Image& image); |
84 | 86 |
85 | 87 |
86 ImageFetcherDelegate* delegate_; | 88 ImageFetcherDelegate* delegate_; |
87 | 89 |
88 scoped_refptr<net::URLRequestContextGetter> url_request_context_; | 90 scoped_refptr<net::URLRequestContextGetter> url_request_context_; |
89 | 91 |
90 std::unique_ptr<ImageDecoder> image_decoder_; | 92 std::unique_ptr<ImageDecoder> image_decoder_; |
91 | 93 |
92 std::unique_ptr<ImageDataFetcher> image_data_fetcher_; | 94 std::unique_ptr<ImageDataFetcher> image_data_fetcher_; |
93 | 95 |
94 // Map from each image URL to the request information (associated website | 96 // Map from each image URL to the request information (associated website |
95 // url, fetcher, pending callbacks). | 97 // url, fetcher, pending callbacks). |
96 ImageRequestMap pending_net_requests_; | 98 ImageRequestMap pending_net_requests_; |
97 | 99 |
98 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); | 100 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); |
99 }; | 101 }; |
100 | 102 |
101 } // namespace image_fetcher | 103 } // namespace image_fetcher |
102 | 104 |
103 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ | 105 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_FETCHER_IMPL_H_ |
OLD | NEW |