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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1085783002: Replace image_messages.h with Mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix trybot unit_tests error Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index d1a5260ed8d53fe55cd41c6fe4a1c3374ea967dc..f307f05cf758a7f06eb55c5244aa0e18e53ff184 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -62,7 +62,6 @@
#include "content/common/browser_plugin/browser_plugin_constants.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/common/frame_messages.h"
-#include "content/common/image_messages.h"
#include "content/common/input_messages.h"
#include "content/common/ssl_status_serialization.h"
#include "content/common/view_messages.h"
@@ -135,21 +134,6 @@ const char kWebContentsAndroidKey[] = "web_contents_android";
base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> >
g_created_callbacks = LAZY_INSTANCE_INITIALIZER;
-static int StartDownload(RenderFrameHost* rfh,
- const GURL& url,
- bool is_favicon,
- uint32_t max_bitmap_size,
- bool bypass_cache) {
- static int g_next_image_download_id = 0;
- rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(),
- ++g_next_image_download_id,
- url,
- is_favicon,
- max_bitmap_size,
- bypass_cache));
- return g_next_image_download_id;
-}
-
void NotifyCacheOnIO(
scoped_refptr<net::URLRequestContextGetter> request_context,
const GURL& url,
@@ -611,7 +595,6 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
OnBrowserPluginMessage(render_frame_host,
message))
#endif
- IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
IPC_MESSAGE_HANDLER(ViewHostMsg_ShowValidationMessage,
OnShowValidationMessage)
@@ -2579,9 +2562,8 @@ int WebContentsImpl::DownloadImage(const GURL& url,
uint32_t max_bitmap_size,
bool bypass_cache,
const ImageDownloadCallback& callback) {
- int id = StartDownload(GetMainFrame(), url, is_favicon, max_bitmap_size,
- bypass_cache);
- image_download_map_[id] = callback;
+ int id = GetMainFrame()->DownloadImage(url, is_favicon, max_bitmap_size,
+ bypass_cache, callback);
return id;
}
@@ -3157,28 +3139,6 @@ void WebContentsImpl::OnBrowserPluginMessage(RenderFrameHost* render_frame_host,
}
#endif // defined(ENABLE_PLUGINS)
-void WebContentsImpl::OnDidDownloadImage(
- int id,
- int http_status_code,
- const GURL& image_url,
- const std::vector<SkBitmap>& bitmaps,
- const std::vector<gfx::Size>& original_bitmap_sizes) {
- if (bitmaps.size() != original_bitmap_sizes.size())
- return;
-
- ImageDownloadMap::iterator iter = image_download_map_.find(id);
- if (iter == image_download_map_.end()) {
- // Currently WebContents notifies us of ANY downloads so that it is
- // possible to get here.
- return;
- }
- if (!iter->second.is_null()) {
- iter->second.Run(
- id, http_status_code, image_url, bitmaps, original_bitmap_sizes);
- }
- image_download_map_.erase(id);
-}
-
void WebContentsImpl::OnUpdateFaviconURL(
const std::vector<FaviconURL>& candidates) {
// We get updated favicon URLs after the page stops loading. If a cross-site

Powered by Google App Engine
This is Rietveld 408576698