Index: content/renderer/image_loading_helper.h |
diff --git a/content/renderer/favicon_helper.h b/content/renderer/image_loading_helper.h |
similarity index 39% |
rename from content/renderer/favicon_helper.h |
rename to content/renderer/image_loading_helper.h |
index 65032ec11c6d3d56d980eda34873c5dd5070375f..6e2302de603c97755c75587f4676ba2fe45dd7de 100644 |
--- a/content/renderer/favicon_helper.h |
+++ b/content/renderer/image_loading_helper.h |
@@ -1,75 +1,57 @@ |
-// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2013 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_RENDERER_FAVICON_HELPER_H_ |
-#define CONTENT_RENDERER_FAVICON_HELPER_H_ |
+#ifndef CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ |
+#define CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ |
#include <string> |
#include <vector> |
-#include "base/memory/linked_ptr.h" |
#include "base/memory/scoped_vector.h" |
-#include "base/memory/weak_ptr.h" |
-#include "content/public/common/content_constants.h" |
#include "content/public/renderer/render_view_observer.h" |
#include "googleurl/src/gurl.h" |
class SkBitmap; |
-namespace content { |
-struct FaviconURL; |
-} |
- |
namespace webkit_glue { |
class MultiResolutionImageResourceFetcher; |
} |
namespace content { |
-struct FaviconURL; |
- |
-// This class deals with favicon downloading. |
-// There is one FaviconHelper per RenderView, which is owned by the RenderView. |
-class FaviconHelper : public RenderViewObserver { |
+// This class deals with image downloading. |
+// One instance of ImageLoadingHelper is owned by RenderView. |
+class ImageLoadingHelper : public RenderViewObserver { |
public: |
- explicit FaviconHelper(RenderView* render_view); |
- |
- // Send a message that the favicon has changed. |
- void DidChangeIcon(WebKit::WebFrame* frame, |
- WebKit::WebIconURL::Type icon_type); |
+ explicit ImageLoadingHelper(RenderView* render_view); |
private: |
- virtual ~FaviconHelper(); |
- |
- // Start processing the icon change. This done async from DidChangeIcon in |
- // case there are several calls to DidChangeIcon in a row. |
- void ProcessDidChangeIcon(); |
+ virtual ~ImageLoadingHelper(); |
// Message handler. |
- void OnDownloadFavicon(int id, |
- const GURL& image_url, |
- bool is_favicon, |
- int image_size); |
+ void OnDownloadImage(int id, |
+ const GURL& image_url, |
+ bool is_favicon, |
+ int image_size); |
- // Requests to download a favicon image. When done, the RenderView |
- // is notified by way of DidDownloadFavicon. Returns true if the |
+ // Requests to download an image. When done, the ImageLoadingHelper |
+ // is notified by way of DidDownloadImage. Returns true if the |
// request was successfully started, false otherwise. id is used to |
// uniquely identify the request and passed back to the |
- // DidDownloadFavicon method. If the image is a favicon, cookies are |
- // not sent and not accepted during download. |
- // If the image has multiple frames, the |
+ // DidDownloadImage method. If the image is a favicon, cookies will not be |
+ // sent nor accepted during download. If the image has multiple frames, the |
// frame whose size is image_size is returned. If the image doesn't |
// have a frame at the specified size, the first is returned. |
- bool DownloadFavicon(int id, |
- const GURL& image_url, |
- bool is_favicon, |
- int image_size); |
+ bool DownloadImage(int id, |
+ const GURL& image_url, |
+ bool is_favicon, |
+ int image_size); |
- // This callback is triggered when DownloadFavicon completes, either |
- // succesfully or with a failure. See DownloadFavicon for more |
+ // This callback is triggered when DownloadImage completes, either |
+ // succesfully or with a failure. See DownloadImage for more |
// details. |
- void DidDownloadFavicon( |
+ void DidDownloadImage( |
int requested_size, |
webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
const std::vector<SkBitmap>& images); |
@@ -77,30 +59,19 @@ class FaviconHelper : public RenderViewObserver { |
// Decodes a data: URL image or returns an empty image in case of failure. |
SkBitmap ImageFromDataUrl(const GURL&) const; |
- // Send a message to update the favicon URL for a page. |
- void SendUpdateFaviconURL(int32 routing_id, |
- int32 page_id, |
- const std::vector<FaviconURL>& urls); |
- |
// RenderViewObserver implementation. |
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
- virtual void DidStopLoading() OVERRIDE; |
typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> |
- ImageResourceFetcherList; |
+ ImageResourceFetcherList; |
// ImageResourceFetchers schedule via DownloadImage. |
ImageResourceFetcherList image_fetchers_; |
- // The set of flags which have been sent to DidChangeIcon but not yet |
- // processed. |
- WebKit::WebIconURL::Type icon_types_changed_; |
- |
- base::WeakPtrFactory<FaviconHelper> weak_ptr_factory_; |
- |
- DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
+ DISALLOW_COPY_AND_ASSIGN(ImageLoadingHelper); |
}; |
-} // namespace content |
+} // namespace content |
+ |
+#endif // CONTENT_RENDERER_IMAGE_LOADING_HELPER_H_ |
-#endif // CONTENT_RENDERER_FAVICON_HELPER_H_ |