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_CORE_IMAGE_FETCHER_IMPL_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_IMPL_H_ |
6 #define COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_IMPL_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "components/image_fetcher/core/image_data_fetcher.h" | 16 #include "components/image_fetcher/core/image_data_fetcher.h" |
17 #include "components/image_fetcher/core/image_decoder.h" | 17 #include "components/image_fetcher/core/image_decoder.h" |
18 #include "components/image_fetcher/core/image_fetcher.h" | 18 #include "components/image_fetcher/core/image_fetcher.h" |
| 19 #include "net/traffic_annotation/network_traffic_annotation.h" |
19 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class Image; | 24 class Image; |
24 } | 25 } |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
28 } | 29 } |
29 | 30 |
30 namespace image_fetcher { | 31 namespace image_fetcher { |
31 | 32 |
32 // The standard (non-test) implementation of ImageFetcher. | 33 // The standard (non-test) implementation of ImageFetcher. |
33 class ImageFetcherImpl : public image_fetcher::ImageFetcher { | 34 class ImageFetcherImpl : public image_fetcher::ImageFetcher { |
34 public: | 35 public: |
35 ImageFetcherImpl(std::unique_ptr<ImageDecoder> image_decoder, | 36 ImageFetcherImpl(std::unique_ptr<ImageDecoder> image_decoder, |
36 net::URLRequestContextGetter* url_request_context); | 37 net::URLRequestContextGetter* url_request_context, |
| 38 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
37 ~ImageFetcherImpl() override; | 39 ~ImageFetcherImpl() override; |
38 | 40 |
39 // Sets the |delegate| of the ImageFetcherImpl. The |delegate| has to be alive | 41 // Sets the |delegate| of the ImageFetcherImpl. The |delegate| has to be alive |
40 // during the lifetime of the ImageFetcherImpl object. It is the caller's | 42 // during the lifetime of the ImageFetcherImpl object. It is the caller's |
41 // responsibility to ensure this. | 43 // responsibility to ensure this. |
42 void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) override; | 44 void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) override; |
43 | 45 |
44 // Sets a service name against which to track data usage. | 46 // Sets a service name against which to track data usage. |
45 void SetDataUseServiceName(DataUseServiceName data_use_service_name) override; | 47 void SetDataUseServiceName(DataUseServiceName data_use_service_name) override; |
46 | 48 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Map from each image URL to the request information (associated website | 103 // Map from each image URL to the request information (associated website |
102 // url, fetcher, pending callbacks). | 104 // url, fetcher, pending callbacks). |
103 ImageRequestMap pending_net_requests_; | 105 ImageRequestMap pending_net_requests_; |
104 | 106 |
105 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); | 107 DISALLOW_COPY_AND_ASSIGN(ImageFetcherImpl); |
106 }; | 108 }; |
107 | 109 |
108 } // namespace image_fetcher | 110 } // namespace image_fetcher |
109 | 111 |
110 #endif // COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_IMPL_H_ | 112 #endif // COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_IMPL_H_ |
OLD | NEW |