Index: chrome/renderer/favicon_helper.h |
diff --git a/chrome/renderer/favicon_helper.h b/chrome/renderer/favicon_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3100c9261bb7018511b747d6764094ce012d344b |
--- /dev/null |
+++ b/chrome/renderer/favicon_helper.h |
@@ -0,0 +1,73 @@ |
+// Copyright (c) 2011 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 CHROME_RENDERER_FAVICON_HELPER_H_ |
+#define CHROME_RENDERER_FAVICON_HELPER_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+ |
+#include "base/memory/linked_ptr.h" |
+#include "content/public/renderer/render_view_observer.h" |
+#include "googleurl/src/gurl.h" |
+ |
+struct FaviconURL; |
+class SkBitmap; |
+ |
+namespace webkit_glue { |
+class MultiResolutionImageResourceFetcher; |
+} |
+ |
+// This class deals with favicon downloading. |
+// There is one FaviconHelper per RenderView. |
+ |
+class FaviconHelper : public content::RenderViewObserver { |
+ public: |
+ explicit FaviconHelper(content::RenderView* render_view); |
+ virtual ~FaviconHelper(); |
+ |
+ // Send a message to update the favicon URL for a page. |
+ void SendUpdateFaviconURL(int32 routing_id, |
+ int32 page_id, |
+ const std::vector<FaviconURL>& urls); |
+ |
+ private: |
joth
2012/10/24 22:02:23
unindent one space nit
Cait (Slow)
2012/10/25 20:29:23
Done.
|
+ // This callback is triggered when DownloadFavicon completes, either |
+ // succesfully or with a failure. See DownloadFavicon for more |
+ // details. |
+ void DidDownloadFavicon( |
+ int requested_size, |
+ webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
+ const std::vector<SkBitmap>& images); |
+ |
+ // Requests to download a favicon image. When done, the RenderView |
+ // is notified by way of DidDownloadFavicon. 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 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, int image_size); |
+ |
+ // Decodes a data: URL image or returns an empty image in case of failure. |
+ SkBitmap ImageFromDataUrl(const GURL&) const; |
+ |
+ // Message handler. |
+ void OnDownloadFavicon(int id, const GURL& image_url, int image_size); |
+ |
+ // RenderViewObserver implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ typedef std::vector< |
+ linked_ptr<webkit_glue::MultiResolutionImageResourceFetcher> > |
joth
2012/10/24 22:02:23
can this be ScopedVector<webkit_glue::MultiResolut
Cait (Slow)
2012/10/25 20:29:23
Done.
|
+ ImageResourceFetcherList; |
+ |
+ // ImageResourceFetchers schedule via DownloadImage. |
+ ImageResourceFetcherList image_fetchers_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
+}; |
+ |
+#endif // CHROME_RENDERER_FAVICON_HELPER_H_ |