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 } |
(...skipping 16 matching lines...) Expand all Loading... |
45 void SetDataUseServiceName(DataUseServiceName data_use_service_name) override; | 46 void SetDataUseServiceName(DataUseServiceName data_use_service_name) override; |
46 | 47 |
47 void SetDesiredImageFrameSize(const gfx::Size& size) override; | 48 void SetDesiredImageFrameSize(const gfx::Size& size) override; |
48 | 49 |
49 void SetImageDownloadLimit( | 50 void SetImageDownloadLimit( |
50 base::Optional<int64_t> max_download_bytes) override; | 51 base::Optional<int64_t> max_download_bytes) override; |
51 | 52 |
52 void StartOrQueueNetworkRequest( | 53 void StartOrQueueNetworkRequest( |
53 const std::string& id, | 54 const std::string& id, |
54 const GURL& image_url, | 55 const GURL& image_url, |
55 const ImageFetcherCallback& callback) override; | 56 const ImageFetcherCallback& callback, |
| 57 const net::NetworkTrafficAnnotationTag& traffic_annotation) override; |
56 | 58 |
57 ImageDecoder* GetImageDecoder() override; | 59 ImageDecoder* GetImageDecoder() override; |
58 | 60 |
59 private: | 61 private: |
60 // State related to an image fetch (id, pending callbacks). | 62 // State related to an image fetch (id, pending callbacks). |
61 struct ImageRequest { | 63 struct ImageRequest { |
62 ImageRequest(); | 64 ImageRequest(); |
63 ImageRequest(const ImageRequest& other); | 65 ImageRequest(const ImageRequest& other); |
64 ~ImageRequest(); | 66 ~ImageRequest(); |
65 | 67 |
(...skipping 35 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 |