| 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 CHROME_RENDERER_FAVICON_HELPER_H_ |
| 6 #define CHROME_RENDERER_FAVICON_HELPER_H_ | 6 #define CHROME_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 |
| 23 // This class deals with favicon downloading. | 26 // This class deals with favicon downloading. |
| 24 // There is one FaviconHelper per RenderView, which is owned by the RenderView. | 27 // There is one FaviconHelper per RenderView, which is owned by the RenderView. |
| 25 class FaviconHelper : public content::RenderViewObserver { | 28 class FaviconHelper : public content::RenderViewObserver { |
| 26 public: | 29 public: |
| 27 explicit FaviconHelper(content::RenderView* render_view); | 30 explicit FaviconHelper(content::RenderView* render_view); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 48 int requested_size, | 51 int requested_size, |
| 49 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, | 52 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
| 50 const std::vector<SkBitmap>& images); | 53 const std::vector<SkBitmap>& images); |
| 51 | 54 |
| 52 // Decodes a data: URL image or returns an empty image in case of failure. | 55 // Decodes a data: URL image or returns an empty image in case of failure. |
| 53 SkBitmap ImageFromDataUrl(const GURL&) const; | 56 SkBitmap ImageFromDataUrl(const GURL&) const; |
| 54 | 57 |
| 55 // Send a message to update the favicon URL for a page. | 58 // Send a message to update the favicon URL for a page. |
| 56 void SendUpdateFaviconURL(int32 routing_id, | 59 void SendUpdateFaviconURL(int32 routing_id, |
| 57 int32 page_id, | 60 int32 page_id, |
| 58 const std::vector<FaviconURL>& urls); | 61 const std::vector<content::FaviconURL>& urls); |
| 59 | 62 |
| 60 // RenderViewObserver implementation. | 63 // RenderViewObserver implementation. |
| 61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 64 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 62 virtual void DidStopLoading() OVERRIDE; | 65 virtual void DidStopLoading() OVERRIDE; |
| 63 virtual void DidChangeIcon(WebKit::WebFrame* frame, | 66 virtual void DidChangeIcon(WebKit::WebFrame* frame, |
| 64 WebKit::WebIconURL::Type icon_type) OVERRIDE; | 67 WebKit::WebIconURL::Type icon_type) OVERRIDE; |
| 65 | 68 |
| 66 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> | 69 typedef ScopedVector<webkit_glue::MultiResolutionImageResourceFetcher> |
| 67 ImageResourceFetcherList; | 70 ImageResourceFetcherList; |
| 68 | 71 |
| 69 // ImageResourceFetchers schedule via DownloadImage. | 72 // ImageResourceFetchers schedule via DownloadImage. |
| 70 ImageResourceFetcherList image_fetchers_; | 73 ImageResourceFetcherList image_fetchers_; |
| 71 | 74 |
| 72 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); | 75 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 #endif // CHROME_RENDERER_FAVICON_HELPER_H_ | 78 #endif // CHROME_RENDERER_FAVICON_HELPER_H_ |
| OLD | NEW |