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

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: fixed android 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
jam 2013/03/19 20:12:21 it seems that this file is now really small and th
Dmitry Titov 2013/03/20 01:30:22 Done, the code moved to RVImpl, removed the files.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_FAVICON_HELPER_H_ 5 #ifndef CONTENT_RENDERER_FAVICON_HELPER_H_
6 #define CONTENT_RENDERER_FAVICON_HELPER_H_ 6 #define CONTENT_RENDERER_FAVICON_HELPER_H_
7 7
8 #include <string>
9 #include <vector> 8 #include <vector>
10 9
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/scoped_vector.h"
13 #include "content/public/renderer/render_view_observer.h" 10 #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 11
26 namespace content { 12 namespace content {
27 13
28 struct FaviconURL; 14 struct FaviconURL;
29 15
30 // This class deals with favicon downloading. 16 // This class deals with favicon updates.
31 // There is one FaviconHelper per RenderView, which is owned by the RenderView. 17 // There is one FaviconHelper per RenderView, which is owned by the RenderView.
32 class FaviconHelper : public RenderViewObserver { 18 class FaviconHelper : public RenderViewObserver {
33 public: 19 public:
34 explicit FaviconHelper(RenderView* render_view); 20 explicit FaviconHelper(RenderView* render_view);
35 21
36 // Sund a message that the favicon has changed. 22 // Sund a message that the favicon has changed.
37 void DidChangeIcon(WebKit::WebFrame* frame, 23 void DidChangeIcon(WebKit::WebFrame* frame,
38 WebKit::WebIconURL::Type icon_type); 24 WebKit::WebIconURL::Type icon_type);
39 25
40 private: 26 private:
41 virtual ~FaviconHelper(); 27 virtual ~FaviconHelper();
42 28
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. 29 // Send a message to update the favicon URL for a page.
67 void SendUpdateFaviconURL(int32 routing_id, 30 void SendUpdateFaviconURL(int32 routing_id,
68 int32 page_id, 31 int32 page_id,
69 const std::vector<FaviconURL>& urls); 32 const std::vector<FaviconURL>& urls);
70 33
71 // RenderViewObserver implementation. 34 // RenderViewObserver implementation.
72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
73 virtual void DidStopLoading() OVERRIDE; 35 virtual void DidStopLoading() OVERRIDE;
74 36
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); 37 DISALLOW_COPY_AND_ASSIGN(FaviconHelper);
82 }; 38 };
83 39
84 } // namespace content 40 } // namespace content
85 41
86 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_ 42 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698