| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ | |
| 6 #define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "content/public/common/manifest.h" | |
| 10 #include "url/gurl.h" | |
| 11 | |
| 12 // Selects the square icon with the supported image MIME types and the specified | |
| 13 // icon purpose that most closely matches the size constraints. | |
| 14 // This follows very basic heuristics -- improvements are welcome. | |
| 15 class ManifestIconSelector { | |
| 16 public: | |
| 17 // Runs the algorithm to find the best matching icon in the icons listed in | |
| 18 // the Manifest. Size is defined in pixels. | |
| 19 // | |
| 20 // Any icon returned will be close as possible to |ideal_icon_size_in_px| | |
| 21 // with a size not less than |minimum_icon_size_in_px|. Additionally, it must | |
| 22 // be square, have supported image MIME types, and have icon purpose | |
| 23 // |purpose|. | |
| 24 // | |
| 25 // Returns the icon url if a suitable icon is found. An empty URL otherwise. | |
| 26 static GURL FindBestMatchingIcon( | |
| 27 const std::vector<content::Manifest::Icon>& icons, | |
| 28 int ideal_icon_size_in_px, | |
| 29 int minimum_icon_size_in_px, | |
| 30 content::Manifest::Icon::IconPurpose purpose); | |
| 31 | |
| 32 private: | |
| 33 DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector); | |
| 34 }; | |
| 35 | |
| 36 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ | |
| OLD | NEW |