OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ | 5 #ifndef CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ |
6 #define CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ | 6 #define CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // URL of the image we're downloading. | 46 // URL of the image we're downloading. |
47 const GURL& image_url() const { return image_url_; } | 47 const GURL& image_url() const { return image_url_; } |
48 | 48 |
49 // Unique identifier for the request. | 49 // Unique identifier for the request. |
50 int id() const { return id_; } | 50 int id() const { return id_; } |
51 | 51 |
52 // HTTP status code upon fetch completion. | 52 // HTTP status code upon fetch completion. |
53 int http_status_code() const { return http_status_code_; } | 53 int http_status_code() const { return http_status_code_; } |
54 | 54 |
| 55 // Called when associated RenderFrame is destructed. |
| 56 void OnRenderFrameDestruct(); |
| 57 |
55 private: | 58 private: |
56 // ResourceFetcher::Callback. Decodes the image and invokes callback_. | 59 // ResourceFetcher::Callback. Decodes the image and invokes callback_. |
57 void OnURLFetchComplete(const blink::WebURLResponse& response, | 60 void OnURLFetchComplete(const blink::WebURLResponse& response, |
58 const std::string& data); | 61 const std::string& data); |
59 | 62 |
60 Callback callback_; | 63 Callback callback_; |
61 | 64 |
62 // Unique identifier for the request. | 65 // Unique identifier for the request. |
63 const int id_; | 66 const int id_; |
64 | 67 |
65 // HTTP status code upon fetch completion. | 68 // HTTP status code upon fetch completion. |
66 int http_status_code_; | 69 int http_status_code_; |
67 | 70 |
68 // URL of the image. | 71 // URL of the image. |
69 const GURL image_url_; | 72 const GURL image_url_; |
70 | 73 |
71 // Does the actual download. | 74 // Does the actual download. |
72 std::unique_ptr<AssociatedResourceFetcher> fetcher_; | 75 std::unique_ptr<AssociatedResourceFetcher> fetcher_; |
73 | 76 |
74 DISALLOW_COPY_AND_ASSIGN(MultiResolutionImageResourceFetcher); | 77 DISALLOW_COPY_AND_ASSIGN(MultiResolutionImageResourceFetcher); |
75 }; | 78 }; |
76 | 79 |
77 } // namespace content | 80 } // namespace content |
78 | 81 |
79 #endif // CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ | 82 #endif // CONTENT_RENDERER_FETCHERS_MULTI_RESOLUTION_IMAGE_RESOURCE_FETCHER_H_ |
OLD | NEW |