Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1595)

Side by Side Diff: content/renderer/image_downloader/image_downloader_impl.h

Issue 2538853002: Media Remoting: Draw remoting interstitial on poster image. (Closed)
Patch Set: Addressed nasko's comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
9
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "base/memory/scoped_vector.h"
14 #include "content/common/image_downloader/image_downloader.mojom.h" 8 #include "content/common/image_downloader/image_downloader.mojom.h"
15 #include "content/public/renderer/render_frame_observer.h" 9 #include "content/renderer/image_downloader/image_downloader_base.h"
16 #include "content/public/renderer/render_thread_observer.h"
17 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
18 #include "url/gurl.h"
19
20 class SkBitmap;
21
22 namespace gfx {
23 class Size;
24 }
25 11
26 namespace content { 12 namespace content {
27 13
28 class MultiResolutionImageResourceFetcher;
29 class RenderFrame;
30
31 class ImageDownloaderImpl : public mojom::ImageDownloader, 14 class ImageDownloaderImpl : public mojom::ImageDownloader,
32 public RenderFrameObserver, 15 public ImageDownloaderBase {
33 public RenderThreadObserver {
34 public: 16 public:
35 ~ImageDownloaderImpl() override; 17 ~ImageDownloaderImpl() override;
36 18
37 static void CreateMojoService(RenderFrame* render_frame, 19 static void CreateMojoService(RenderFrame* render_frame,
38 mojom::ImageDownloaderRequest request); 20 mojom::ImageDownloaderRequest request);
39 21
40 // RenderThreadObserver implementation.
41 void OnRenderProcessShutdown() override;
42
43 private: 22 private:
44 ImageDownloaderImpl(RenderFrame* render_frame, 23 ImageDownloaderImpl(RenderFrame* render_frame,
45 mojom::ImageDownloaderRequest request); 24 mojom::ImageDownloaderRequest request);
46 25
47 // RenderFrameObserver implementation. 26 // Override ImageDownloaderBase::OnDestruct().
48 void OnDestruct() override; 27 void OnDestruct() override;
49 28
50 // ImageDownloader methods: 29 // ImageDownloader implementation.
51 void DownloadImage(const GURL& url, 30 void DownloadImage(const GURL& url,
52 bool is_favicon, 31 bool is_favicon,
53 uint32_t max_bitmap_size, 32 uint32_t max_bitmap_size,
54 bool bypass_cache, 33 bool bypass_cache,
55 const DownloadImageCallback& callback) override; 34 const DownloadImageCallback& callback) override;
56 35
57 // Requests to fetch an image. When done, the ImageDownloaderImpl 36 // Called when downloading finishes. All frames in |images| whose size <=
58 // is notified by way of DidFetchImage. Returns true if the 37 // |max_image_size| will be returned through |callback|. If all of the frames
59 // request was successfully started, false otherwise. 38 // are larger than |max_image_size|, the smallest frame is resized to
60 // If the image is a favicon, cookies will not be
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
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 39 // |max_image_size| and is the only result. |max_image_size| == 0 is
65 // interpreted as no max image size. 40 // interpreted as no max image size.
66 bool FetchImage(const GURL& image_url, 41 void DidDownloadImage(uint32_t max_bitmap_size,
67 bool is_favicon, 42 const DownloadImageCallback& callback,
68 uint32_t max_image_size, 43 int32_t http_status_code,
69 bool bypass_cache, 44 const std::vector<SkBitmap>& images);
70 const DownloadImageCallback& callback);
71
72 // This callback is triggered when FetchImage completes, either
73 // succesfully or with a failure. See FetchImage for more
74 // details.
75 void DidFetchImage(uint32_t max_image_size,
76 const DownloadImageCallback& callback,
77 MultiResolutionImageResourceFetcher* fetcher,
78 const std::vector<SkBitmap>& images);
79
80 // Reply download result
81 void ReplyDownloadResult(
82 int32_t http_status_code,
83 const std::vector<SkBitmap>& result_images,
84 const std::vector<gfx::Size>& result_original_image_sizes,
85 const DownloadImageCallback& callback);
86
87 typedef ScopedVector<MultiResolutionImageResourceFetcher>
88 ImageResourceFetcherList;
89
90 // ImageResourceFetchers schedule via FetchImage.
91 ImageResourceFetcherList image_fetchers_;
92 45
93 mojo::Binding<mojom::ImageDownloader> binding_; 46 mojo::Binding<mojom::ImageDownloader> binding_;
94 47
95 DISALLOW_COPY_AND_ASSIGN(ImageDownloaderImpl); 48 DISALLOW_COPY_AND_ASSIGN(ImageDownloaderImpl);
96 }; 49 };
97 50
98 } // namespace content 51 } // namespace content
99 52
100 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_ 53 #endif // CONTENT_RENDERER_IMAGE_DOWNLOADER_IMAGE_DOWNLOADER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/image_downloader/image_downloader_base.cc ('k') | content/renderer/image_downloader/image_downloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698