| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_DOWNLOADER_H_ |
| 6 #define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ | 6 #define CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_DOWNLOADER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "content/common/content_export.h" |
| 12 | 13 |
| 14 class GURL; |
| 13 class SkBitmap; | 15 class SkBitmap; |
| 14 | 16 |
| 15 namespace content { | |
| 16 class WebContents; | |
| 17 } // namespace content | |
| 18 | |
| 19 namespace gfx { | 17 namespace gfx { |
| 20 class Size; | 18 class Size; |
| 21 } // namespace gfx | 19 } // namespace gfx |
| 22 | 20 |
| 23 class GURL; | 21 namespace content { |
| 22 |
| 23 class WebContents; |
| 24 | 24 |
| 25 // Helper class which downloads the icon located at a specified. If the icon | 25 // Helper class which downloads the icon located at a specified. If the icon |
| 26 // file contains multiple icons then it attempts to pick the one closest in size | 26 // file contains multiple icons then it attempts to pick the one closest in size |
| 27 // bigger than or equal to ideal_icon_size_in_px, taking into account the | 27 // bigger than or equal to ideal_icon_size_in_px, taking into account the |
| 28 // density of the device. If a bigger icon is chosen then, the icon is scaled | 28 // density of the device. If a bigger icon is chosen then, the icon is scaled |
| 29 // down to be equal to ideal_icon_size_in_px. Smaller icons will be chosen down | 29 // down to be equal to ideal_icon_size_in_px. Smaller icons will be chosen down |
| 30 // to the value specified by |minimum_icon_size_in_px|. | 30 // to the value specified by |minimum_icon_size_in_px|. |
| 31 class ManifestIconDownloader final { | 31 class CONTENT_EXPORT ManifestIconDownloader final { |
| 32 public: | 32 public: |
| 33 using IconFetchCallback = base::Callback<void(const SkBitmap&)>; | 33 using IconFetchCallback = base::Callback<void(const SkBitmap&)>; |
| 34 | 34 |
| 35 ManifestIconDownloader() = delete; | 35 ManifestIconDownloader() = delete; |
| 36 ~ManifestIconDownloader() = delete; | 36 ~ManifestIconDownloader() = delete; |
| 37 | 37 |
| 38 // Returns whether the download has started. | 38 // Returns whether the download has started. |
| 39 // It will return false if the current context or information do not allow to | 39 // It will return false if the current context or information do not allow to |
| 40 // download the image. | 40 // download the image. |
| 41 static bool Download(content::WebContents* web_contents, | 41 static bool Download(content::WebContents* web_contents, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 65 | 65 |
| 66 static int FindClosestBitmapIndex(int ideal_icon_size_in_px, | 66 static int FindClosestBitmapIndex(int ideal_icon_size_in_px, |
| 67 int minimum_icon_size_in_px, | 67 int minimum_icon_size_in_px, |
| 68 const std::vector<SkBitmap>& bitmaps); | 68 const std::vector<SkBitmap>& bitmaps); |
| 69 | 69 |
| 70 friend class ManifestIconDownloaderTest; | 70 friend class ManifestIconDownloaderTest; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(ManifestIconDownloader); | 72 DISALLOW_COPY_AND_ASSIGN(ManifestIconDownloader); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_DOWNLOADER_H_ | 75 } // namespace content |
| 76 |
| 77 #endif // CONTENT_PUBLIC_BROWSER_MANIFEST_ICON_DOWNLOADER_H_ |
| OLD | NEW |