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

Side by Side Diff: content/renderer/favicon_helper.h

Issue 12780024: Split FaviconHelper in two: ImageLoadingHelper and FaviconHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_RENDERER_FAVICON_HELPER_H_
6 #define CONTENT_RENDERER_FAVICON_HELPER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_vector.h"
13 #include "content/public/renderer/render_view_observer.h"
14 #include "googleurl/src/gurl.h"
15
16 class SkBitmap;
17
18 namespace content {
19 struct FaviconURL;
20 }
21
22 namespace webkit_glue {
23 class MultiResolutionImageResourceFetcher;
24 }
25
26 namespace content {
27
28 struct FaviconURL;
29
30 // This class deals with favicon downloading.
31 // There is one FaviconHelper per RenderView, which is owned by the RenderView.
32 class FaviconHelper : public RenderViewObserver {
33 public:
34 explicit FaviconHelper(RenderView* render_view);
35
36 // Sund a message that the favicon has changed.
37 void DidChangeIcon(WebKit::WebFrame* frame,
38 WebKit::WebIconURL::Type icon_type);
39
40 private:
41 virtual ~FaviconHelper();
42
43 // Message handler.
44 void OnDownloadFavicon(int id, const GURL& image_url, int image_size);
45
46 // Requests to download a favicon image. When done, the RenderView
47 // is notified by way of DidDownloadFavicon. Returns true if the
48 // request was successfully started, false otherwise. id is used to
49 // uniquely identify the request and passed back to the
50 // DidDownloadFavicon method. If the image has multiple frames, the
51 // frame whose size is image_size is returned. If the image doesn't
52 // have a frame at the specified size, the first is returned.
53 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
54
55 // This callback is triggered when DownloadFavicon completes, either
56 // succesfully or with a failure. See DownloadFavicon for more
57 // details.
58 void DidDownloadFavicon(
59 int requested_size,
60 webkit_glue::MultiResolutionImageResourceFetcher* fetcher,
61 const std::vector<SkBitmap>& images);
62
63 // Decodes a data: URL image or returns an empty image in case of failure.
64 SkBitmap ImageFromDataUrl(const GURL&) const;
65
66 // Send a message to update the favicon URL for a page.
67 void SendUpdateFaviconURL(int32 routing_id,
68 int32 page_id,
69 const std::vector<FaviconURL>& urls);
70
71 // RenderViewObserver implementation.
72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
73 virtual void DidStopLoading() OVERRIDE;
74
75 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher>
76 ImageResourceFetcherList;
77
78 // ImageResourceFetchers schedule via DownloadImage.
79 ImageResourceFetcherList image_fetchers_;
80
81 DISALLOW_COPY_AND_ASSIGN(FaviconHelper);
82 };
83
84 } // namespace content
85
86 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698