Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ |
| 6 #define CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ | 6 #define CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 class MultiResolutionImageResourceFetcher; | 28 class MultiResolutionImageResourceFetcher; |
| 29 class RenderFrame; | 29 class RenderFrame; |
| 30 | 30 |
| 31 class ImageDownloaderImpl : public mojom::ImageDownloader, | 31 class ImageDownloaderImpl : public mojom::ImageDownloader, |
| 32 public RenderFrameObserver, | 32 public RenderFrameObserver, |
| 33 public RenderThreadObserver { | 33 public RenderThreadObserver { |
| 34 public: | 34 public: |
| 35 ImageDownloaderImpl(RenderFrame* render_frame); | |
|
miu
2016/11/29 22:56:08
Need explicit keyword here.
xjz
2016/12/02 19:23:10
Not applicable.
| |
| 35 ~ImageDownloaderImpl() override; | 36 ~ImageDownloaderImpl() override; |
| 36 | 37 |
| 37 static void CreateMojoService(RenderFrame* render_frame, | 38 static void CreateMojoService(RenderFrame* render_frame, |
| 38 mojom::ImageDownloaderRequest request); | 39 mojom::ImageDownloaderRequest request); |
| 39 | 40 |
| 40 // RenderThreadObserver implementation. | 41 // RenderThreadObserver implementation. |
| 41 void OnRenderProcessShutdown() override; | 42 void OnRenderProcessShutdown() override; |
| 42 | 43 |
| 44 void DownloadImage(const GURL& url, | |
| 45 bool is_favicon, | |
| 46 uint32_t max_bitmap_size, | |
| 47 bool bypass_cache, | |
| 48 const DownloadImageCallback& callback) override; | |
| 49 | |
| 43 private: | 50 private: |
| 44 ImageDownloaderImpl(RenderFrame* render_frame, | 51 ImageDownloaderImpl(RenderFrame* render_frame, |
| 45 mojom::ImageDownloaderRequest request); | 52 mojom::ImageDownloaderRequest request); |
| 46 | 53 |
| 47 // RenderFrameObserver implementation. | 54 // RenderFrameObserver implementation. |
| 48 void OnDestruct() override; | 55 void OnDestruct() override; |
| 49 | 56 |
| 50 // ImageDownloader methods: | |
| 51 void DownloadImage(const GURL& url, | |
| 52 bool is_favicon, | |
| 53 uint32_t max_bitmap_size, | |
| 54 bool bypass_cache, | |
| 55 const DownloadImageCallback& callback) override; | |
| 56 | |
| 57 // Requests to fetch an image. When done, the ImageDownloaderImpl | 57 // Requests to fetch an image. When done, the ImageDownloaderImpl |
| 58 // is notified by way of DidFetchImage. Returns true if the | 58 // is notified by way of DidFetchImage. Returns true if the |
| 59 // request was successfully started, false otherwise. | 59 // request was successfully started, false otherwise. |
| 60 // If the image is a favicon, cookies will not be | 60 // If the image is a favicon, cookies will not be |
| 61 // sent nor accepted during download. If the image has multiple frames, all | 61 // sent nor accepted during download. If the image has multiple frames, all |
| 62 // the frames whose size <= |max_image_size| are returned. If all of the | 62 // the frames whose size <= |max_image_size| are returned. If all of the |
| 63 // frames are larger than |max_image_size|, the smallest frame is resized to | 63 // frames are larger than |max_image_size|, the smallest frame is resized to |
| 64 // |max_image_size| and is the only result. |max_image_size| == 0 is | 64 // |max_image_size| and is the only result. |max_image_size| == 0 is |
| 65 // interpreted as no max image size. | 65 // interpreted as no max image size. |
| 66 bool FetchImage(const GURL& image_url, | 66 bool FetchImage(const GURL& image_url, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 91 ImageResourceFetcherList image_fetchers_; | 91 ImageResourceFetcherList image_fetchers_; |
| 92 | 92 |
| 93 mojo::Binding<mojom::ImageDownloader> binding_; | 93 mojo::Binding<mojom::ImageDownloader> binding_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ImageDownloaderImpl); | 95 DISALLOW_COPY_AND_ASSIGN(ImageDownloaderImpl); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace content | 98 } // namespace content |
| 99 | 99 |
| 100 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ | 100 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ |
| OLD | NEW |