| 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 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> | 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/common/content_constants.h" |
| 13 #include "content/public/renderer/render_view_observer.h" | 14 #include "content/public/renderer/render_view_observer.h" |
| 14 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 15 | 16 |
| 16 class SkBitmap; | 17 class SkBitmap; |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 struct FaviconURL; | 20 struct FaviconURL; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace webkit_glue { | 23 namespace webkit_glue { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 explicit FaviconHelper(RenderView* render_view); | 35 explicit FaviconHelper(RenderView* render_view); |
| 35 | 36 |
| 36 // Sund a message that the favicon has changed. | 37 // Sund a message that the favicon has changed. |
| 37 void DidChangeIcon(WebKit::WebFrame* frame, | 38 void DidChangeIcon(WebKit::WebFrame* frame, |
| 38 WebKit::WebIconURL::Type icon_type); | 39 WebKit::WebIconURL::Type icon_type); |
| 39 | 40 |
| 40 private: | 41 private: |
| 41 virtual ~FaviconHelper(); | 42 virtual ~FaviconHelper(); |
| 42 | 43 |
| 43 // Message handler. | 44 // Message handler. |
| 44 void OnDownloadFavicon(int id, const GURL& image_url, int image_size); | 45 void OnDownloadFavicon(int id, |
| 46 const GURL& image_url, |
| 47 DownloadImageType image_type, |
| 48 int image_size); |
| 45 | 49 |
| 46 // Requests to download a favicon image. When done, the RenderView | 50 // Requests to download a favicon image. When done, the RenderView |
| 47 // is notified by way of DidDownloadFavicon. Returns true if the | 51 // is notified by way of DidDownloadFavicon. Returns true if the |
| 48 // request was successfully started, false otherwise. id is used to | 52 // request was successfully started, false otherwise. id is used to |
| 49 // uniquely identify the request and passed back to the | 53 // uniquely identify the request and passed back to the |
| 50 // DidDownloadFavicon method. If the image has multiple frames, the | 54 // DidDownloadFavicon method. If the image has multiple frames, the |
| 51 // frame whose size is image_size is returned. If the image doesn't | 55 // 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. | 56 // have a frame at the specified size, the first is returned. |
| 53 bool DownloadFavicon(int id, const GURL& image_url, int image_size); | 57 bool DownloadFavicon(int id, |
| 58 const GURL& image_url, |
| 59 DownloadImageType image_type, |
| 60 int image_size); |
| 54 | 61 |
| 55 // This callback is triggered when DownloadFavicon completes, either | 62 // This callback is triggered when DownloadFavicon completes, either |
| 56 // succesfully or with a failure. See DownloadFavicon for more | 63 // succesfully or with a failure. See DownloadFavicon for more |
| 57 // details. | 64 // details. |
| 58 void DidDownloadFavicon( | 65 void DidDownloadFavicon( |
| 59 int requested_size, | 66 int requested_size, |
| 60 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, | 67 webkit_glue::MultiResolutionImageResourceFetcher* fetcher, |
| 61 const std::vector<SkBitmap>& images); | 68 const std::vector<SkBitmap>& images); |
| 62 | 69 |
| 63 // Decodes a data: URL image or returns an empty image in case of failure. | 70 // Decodes a data: URL image or returns an empty image in case of failure. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 77 | 84 |
| 78 // ImageResourceFetchers schedule via DownloadImage. | 85 // ImageResourceFetchers schedule via DownloadImage. |
| 79 ImageResourceFetcherList image_fetchers_; | 86 ImageResourceFetcherList image_fetchers_; |
| 80 | 87 |
| 81 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); | 88 DISALLOW_COPY_AND_ASSIGN(FaviconHelper); |
| 82 }; | 89 }; |
| 83 | 90 |
| 84 } // namespace content | 91 } // namespace content |
| 85 | 92 |
| 86 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_ | 93 #endif // CONTENT_RENDERER_FAVICON_HELPER_H_ |
| OLD | NEW |