OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ | |
6 #define CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "content/common/image_downloader/image_downloader.mojom.h" | |
10 #include "content/public/browser/web_contents.h" | |
11 | |
12 class GURL; | |
13 | |
14 namespace content { | |
15 | |
16 class RenderFrameHost; | |
17 | |
18 // ImageDownloaderDispatcher is specific with RenderFrameHost and | |
19 // responsible for the Mojo connection with ImageDownloader Mojo service | |
20 // in RenderFrame. | |
21 // ImageDownloaderDispatcher provides StartDownload API, | |
22 // send download request via the Mojo connection, | |
23 // and callback caller once got result from the Mojo connection. | |
24 class ImageDownloaderDispatcher : public mojo::ErrorHandler { | |
Anand Mistry (off Chromium)
2015/06/12 08:19:38
I'm strongly inclined to say delete this class and
leonhsl(Using Gerrit)
2015/06/15 08:09:43
I think that ErrorHandler can reset the ImageDownl
Anand Mistry (off Chromium)
2015/06/16 07:51:35
Yes, but the Mojo connection should never terminat
leonhsl(Using Gerrit)
2015/06/23 02:18:02
Done.
| |
25 public: | |
26 explicit ImageDownloaderDispatcher(RenderFrameHost* render_frame_host); | |
27 ~ImageDownloaderDispatcher() override; | |
28 | |
29 int StartDownload(const GURL& url, | |
30 bool is_favicon, | |
31 uint32_t max_bitmap_size, | |
32 bool bypass_cache, | |
33 const WebContents::ImageDownloadCallback& callback); | |
34 | |
35 private: | |
36 // Overidden from mojo::ErrorHandler: | |
37 void OnConnectionError() override; | |
38 | |
39 static int next_image_download_id_; | |
40 | |
41 RenderFrameHost* render_frame_host_; | |
42 image_downloader::ImageDownloaderPtr downloader_; | |
43 | |
44 DISALLOW_COPY_AND_ASSIGN(ImageDownloaderDispatcher); | |
45 }; | |
46 | |
47 } // namespace content | |
48 | |
49 #endif // CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ | |
OLD | NEW |