Index: content/browser/image_downloader/image_downloader_dispatcher.h |
diff --git a/content/browser/image_downloader/image_downloader_dispatcher.h b/content/browser/image_downloader/image_downloader_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23a15548c6a219f94daf10966d975ed3f09697b4 |
--- /dev/null |
+++ b/content/browser/image_downloader/image_downloader_dispatcher.h |
@@ -0,0 +1,49 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ |
+#define CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ |
+ |
+#include "base/macros.h" |
+#include "content/common/image_downloader/image_downloader.mojom.h" |
+#include "content/public/browser/web_contents.h" |
+ |
+class GURL; |
+ |
+namespace content { |
+ |
+class RenderFrameHost; |
+ |
+// ImageDownloaderDispatcher is specific with RenderFrameHost and |
+// responsible for the Mojo connection with ImageDownloader Mojo service |
+// in RenderFrame. |
+// ImageDownloaderDispatcher provides StartDownload API, |
+// send download request via the Mojo connection, |
+// and callback caller once got result from the Mojo connection. |
+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.
|
+ public: |
+ explicit ImageDownloaderDispatcher(RenderFrameHost* render_frame_host); |
+ ~ImageDownloaderDispatcher() override; |
+ |
+ int StartDownload(const GURL& url, |
+ bool is_favicon, |
+ uint32_t max_bitmap_size, |
+ bool bypass_cache, |
+ const WebContents::ImageDownloadCallback& callback); |
+ |
+ private: |
+ // Overidden from mojo::ErrorHandler: |
+ void OnConnectionError() override; |
+ |
+ static int next_image_download_id_; |
+ |
+ RenderFrameHost* render_frame_host_; |
+ image_downloader::ImageDownloaderPtr downloader_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ImageDownloaderDispatcher); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_IMAGE_DOWNLOADER_DISPATCHER_H_ |