OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_RENDERER_FAVICON_HELPER_H_ | 5 #ifndef CONTENT_RENDERER_FAVICON_HELPER_H_ |
6 #define CHROME_RENDERER_FAVICON_HELPER_H_ | 6 #define CONTENT_RENDERER_FAVICON_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "content/public/renderer/render_view_observer.h" | 13 #include "content/public/renderer/render_view_observer.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
| 16 class SkBitmap; |
| 17 |
| 18 namespace content { |
16 struct FaviconURL; | 19 struct FaviconURL; |
17 class SkBitmap; | 20 } |
18 | 21 |
19 namespace webkit_glue { | 22 namespace webkit_glue { |
20 class MultiResolutionImageResourceFetcher; | 23 class MultiResolutionImageResourceFetcher; |
21 } | 24 } |
22 | 25 |
| 26 namespace content { |
| 27 |
| 28 struct FaviconURL; |
| 29 |
23 // This class deals with favicon downloading. | 30 // This class deals with favicon downloading. |
24 // There is one FaviconHelper per RenderView, which is owned by the RenderView. | 31 // There is one FaviconHelper per RenderView, which is owned by the RenderView. |
25 class FaviconHelper : public content::RenderViewObserver { | 32 class FaviconHelper : public RenderViewObserver { |
26 public: | 33 public: |
27 explicit FaviconHelper(content::RenderView* render_view); | 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); |
28 | 39 |
29 private: | 40 private: |
30 virtual ~FaviconHelper(); | 41 virtual ~FaviconHelper(); |
31 | 42 |
32 // Message handler. | 43 // Message handler. |
33 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); | 44 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); |
34 | 45 |
35 // Requests to download a favicon image. When done, the RenderView | 46 // Requests to download a favicon image. When done, the RenderView |
36 // is notified by way of DidDownloadFavicon. Returns true if the | 47 // is notified by way of DidDownloadFavicon. Returns true if the |
37 // request was successfully started, false otherwise. id is used to | 48 // request was successfully started, false otherwise. id is used to |
(...skipping 15 matching lines...) Expand all Loading... |
53 SkBitmap ImageFromDataUrl(const GURL&) const; | 64 SkBitmap ImageFromDataUrl(const GURL&) const; |
54 | 65 |
55 // Send a message to update the favicon URL for a page. | 66 // Send a message to update the favicon URL for a page. |
56 void SendUpdateFaviconURL(int32 routing_id, | 67 void SendUpdateFaviconURL(int32 routing_id, |
57 int32 page_id, | 68 int32 page_id, |
58 const std::vector<FaviconURL>& urls); | 69 const std::vector<FaviconURL>& urls); |
59 | 70 |
60 // RenderViewObserver implementation. | 71 // RenderViewObserver implementation. |
61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 72 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
62 virtual void DidStopLoading() OVERRIDE; | 73 virtual void DidStopLoading() OVERRIDE; |
63 virtual void DidChangeIcon(WebKit::WebFrame* frame, | |
64 WebKit::WebIconURL::Type icon_type) OVERRIDE; | |
65 | 74 |
66 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> | 75 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> |
67 ImageResourceFetcherList; | 76 ImageResourceFetcherList; |
68 | 77 |
69 // ImageResourceFetchers schedule via DownloadImage. | 78 // ImageResourceFetchers schedule via DownloadImage. |
70 ImageResourceFetcherList image_fetchers_; | 79 ImageResourceFetcherList image_fetchers_; |
71 | 80 |
72 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); | 81 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
73 }; | 82 }; |
74 | 83 |
75 #endif // CHROME_RENDERER_FAVICON_HELPER_H_ | 84 } // namespace content |
| 85 |
| 86 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_ |
OLD | NEW |