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); |
28 | 35 |
29 private: | 36 private: |
30 virtual ~FaviconHelper(); | 37 virtual ~FaviconHelper(); |
31 | 38 |
32 // Message handler. | 39 // Message handler. |
33 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); | 40 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); |
34 | 41 |
35 // Requests to download a favicon image. When done, the RenderView | 42 // Requests to download a favicon image. When done, the RenderView |
36 // is notified by way of DidDownloadFavicon. Returns true if the | 43 // is notified by way of DidDownloadFavicon. Returns true if the |
37 // request was successfully started, false otherwise. id is used to | 44 // request was successfully started, false otherwise. id is used to |
(...skipping 10 matching lines...) Expand all Loading... | |
48 int requested_size, | 55 int requested_size, |
49 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, | 56 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
50 const std::vector<SkBitmap>& images); | 57 const std::vector<SkBitmap>& images); |
51 | 58 |
52 // Decodes a data: URL image or returns an empty image in case of failure. | 59 // Decodes a data: URL image or returns an empty image in case of failure. |
53 SkBitmap ImageFromDataUrl(const GURL&) const; | 60 SkBitmap ImageFromDataUrl(const GURL&) const; |
54 | 61 |
55 // Send a message to update the favicon URL for a page. | 62 // Send a message to update the favicon URL for a page. |
56 void SendUpdateFaviconURL(int32 routing_id, | 63 void SendUpdateFaviconURL(int32 routing_id, |
57 int32 page_id, | 64 int32 page_id, |
58 const std::vector<FaviconURL>& urls); | 65 const std::vector<content::FaviconURL>& urls); |
jam
2012/11/27 01:16:31
nit: get rid of "content::"
Cait (Slow)
2012/11/28 00:11:45
Done.
| |
59 | 66 |
60 // RenderViewObserver implementation. | 67 // RenderViewObserver implementation. |
61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 68 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
62 virtual void DidStopLoading() OVERRIDE; | 69 virtual void DidStopLoading() OVERRIDE; |
63 virtual void DidChangeIcon(WebKit::WebFrame* frame, | 70 virtual void DidChangeIcon(WebKit::WebFrame* frame, |
64 WebKit::WebIconURL::Type icon_type) OVERRIDE; | 71 WebKit::WebIconURL::Type icon_type) OVERRIDE; |
65 | 72 |
66 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> | 73 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> |
67 ImageResourceFetcherList; | 74 ImageResourceFetcherList; |
68 | 75 |
69 // ImageResourceFetchers schedule via DownloadImage. | 76 // ImageResourceFetchers schedule via DownloadImage. |
70 ImageResourceFetcherList image_fetchers_; | 77 ImageResourceFetcherList image_fetchers_; |
71 | 78 |
72 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); | 79 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
73 }; | 80 }; |
74 | 81 |
75 #endif // CHROME_RENDERER_FAVICON_HELPER_H_ | 82 } // namespace content |
83 | |
84 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_ | |
OLD | NEW |