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

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

Issue 11232068: Extract renderer-side favicon downloading code into separate helper class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move UpdateFaviconURL code into helper Created 8 years, 2 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 CHROME_RENDERER_FAVICON_HELPER_H_
6 #define CHROME_RENDERER_FAVICON_HELPER_H_
7
8 #include <string>
9 #include <vector>
10
11
12 #include "base/memory/linked_ptr.h"
13 #include "content/public/renderer/render_view_observer.h"
14 #include "googleurl/src/gurl.h"
15
16 struct FaviconURL;
17 class SkBitmap;
18
19 namespace webkit_glue {
20 class MultiResolutionImageResourceFetcher;
21 }
22
23 // This class deals with favicon downloading.
24 // There is one FaviconHelper per RenderView.
25
26 class FaviconHelper : public content::RenderViewObserver {
27 public:
28 explicit FaviconHelper(content::RenderView* render_view);
29 virtual ~FaviconHelper();
30
31 // Send a message to update the favicon URL for a page.
32 void SendUpdateFaviconURL(int32 routing_id,
33 int32 page_id,
34 const std::vector<FaviconURL>& urls);
35
36 private:
joth 2012/10/24 22:02:23 unindent one space nit
Cait (Slow) 2012/10/25 20:29:23 Done.
37 // This callback is triggered when DownloadFavicon completes, either
38 // succesfully or with a failure. See DownloadFavicon for more
39 // details.
40 void DidDownloadFavicon(
41 int requested_size,
42 webkit_glue::MultiResolutionImageResourceFetcher* fetcher,
43 const std::vector<SkBitmap>& images);
44
45 // Requests to download a favicon image. When done, the RenderView
46 // is notified by way of DidDownloadFavicon. Returns true if the
47 // request was successfully started, false otherwise. id is used to
48 // uniquely identify the request and passed back to the
49 // DidDownloadFavicon method. If the image has multiple frames, the
50 // frame whose size is image_size is returned. If the image doesn't
51 // have a frame at the specified size, the first is returned.
52 bool DownloadFavicon(int id, const GURL& image_url, int image_size);
53
54 // Decodes a data: URL image or returns an empty image in case of failure.
55 SkBitmap ImageFromDataUrl(const GURL&) const;
56
57 // Message handler.
58 void OnDownloadFavicon(int id, const GURL& image_url, int image_size);
59
60 // RenderViewObserver implementation.
61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
62
63 typedef std::vector<
64 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.
65 ImageResourceFetcherList;
66
67 // ImageResourceFetchers schedule via DownloadImage.
68 ImageResourceFetcherList image_fetchers_;
69
70 DISALLOW_COPY_AND_ASSIGN(FaviconHelper);
71 };
72
73 #endif // CHROME_RENDERER_FAVICON_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698