| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_FAVICON_FAVICON_UTIL_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
| 6 #define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
| 7 | 7 |
| 8 #include "ui/base/layout.h" |
| 9 |
| 8 class GURL; | 10 class GURL; |
| 9 | 11 |
| 10 namespace content { | 12 namespace content { |
| 11 class RenderViewHost; | 13 class RenderViewHost; |
| 12 } | 14 } |
| 13 | 15 |
| 16 namespace gfx { |
| 17 class Image; |
| 18 } |
| 19 |
| 20 namespace history { |
| 21 struct FaviconBitmapResult; |
| 22 } |
| 23 |
| 14 // Utility class for common favicon related code. | 24 // Utility class for common favicon related code. |
| 15 class FaviconUtil { | 25 class FaviconUtil { |
| 16 public: | 26 public: |
| 17 // Starts the download of the given favicon |url| from the given render view | 27 // Starts the download of the given favicon |url| from the given render view |
| 18 // host. When the download is finished, an IconHostMsg_DidDownloadFavicon IPC | 28 // host. When the download is finished, an IconHostMsg_DidDownloadFavicon IPC |
| 19 // message will be sent. | 29 // message will be sent. |
| 20 // Returns the unique id of the download request. The id will be sent in the | 30 // Returns the unique id of the download request. The id will be sent in the |
| 21 // IPC message. | 31 // IPC message. |
| 22 static int DownloadFavicon(content::RenderViewHost* rvh, | 32 static int DownloadFavicon(content::RenderViewHost* rvh, |
| 23 const GURL& url, | 33 const GURL& url, |
| 24 int image_size); | 34 int image_size); |
| 35 |
| 36 // Takes a vector of png-encoded frames, decodes them, and converts them to |
| 37 // a favicon of size favicon_size (in DIPs) at the desired ui scale factors. |
| 38 static gfx::Image SelectFaviconFramesFromPNGs( |
| 39 const std::vector<history::FaviconBitmapResult>& png_data, |
| 40 const std::vector<ui::ScaleFactor> scale_factors, |
| 41 int favicon_size); |
| 25 }; | 42 }; |
| 26 | 43 |
| 27 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ | 44 #endif // CHROME_BROWSER_FAVICON_FAVICON_UTIL_H_ |
| OLD | NEW |