| Index: chrome/browser/manifest/manifest_icon_selector.h
|
| diff --git a/chrome/browser/manifest/manifest_icon_selector.h b/chrome/browser/manifest/manifest_icon_selector.h
|
| index ae1f7e2d9e7b9e96411eba14e213f75925025a9b..d502aaff74fd7d721bd5a8fb4a0f320b73aaf31a 100644
|
| --- a/chrome/browser/manifest/manifest_icon_selector.h
|
| +++ b/chrome/browser/manifest/manifest_icon_selector.h
|
| @@ -9,64 +9,28 @@
|
| #include "content/public/common/manifest.h"
|
| #include "url/gurl.h"
|
|
|
| -// Selects the icon most closely matching the size constraints. This follows
|
| -// very basic heuristics -- improvements are welcome.
|
| +// Selects the square icon with the supported image MIME types and the specified
|
| +// icon purpose that most closely matches the size constraints.
|
| +// This follows very basic heuristics -- improvements are welcome.
|
| class ManifestIconSelector {
|
| public:
|
| // Runs the algorithm to find the best matching icon in the icons listed in
|
| - // the Manifest.
|
| - //
|
| - // Size is defined in pixels.
|
| + // the Manifest. Size is defined in pixels.
|
| //
|
| // Any icon returned will be close as possible to |ideal_icon_size_in_px|
|
| - // with a size not less than |minimum_icon_size_in_px|.
|
| + // with a size not less than |minimum_icon_size_in_px|. Additionally, it must
|
| + // be square, have supported image MIME types, and have icon purpose
|
| + // |purpose|.
|
| //
|
| // Returns the icon url if a suitable icon is found. An empty URL otherwise.
|
| static GURL FindBestMatchingIcon(
|
| const std::vector<content::Manifest::Icon>& icons,
|
| int ideal_icon_size_in_px,
|
| - int minimum_icon_size_in_px);
|
| + int minimum_icon_size_in_px,
|
| + content::Manifest::Icon::IconPurpose purpose);
|
|
|
| private:
|
| - ManifestIconSelector(int ideal_icon_size_in_px,
|
| - int minimum_icon_size_in_px);
|
| - virtual ~ManifestIconSelector() {}
|
| -
|
| - // Returns the square icon that is the smallest icon larger than
|
| - // ideal_icon_size_in_px_ (if it exists), or the largest icon smaller than
|
| - // ideal_icon_size_in_px_ otherwise.
|
| - int FindClosestIconToIdealSize(
|
| - const std::vector<content::Manifest::Icon>& icons) const;
|
| -
|
| - // Runs the algorithm to find the best matching icon in the icons listed in
|
| - // the Manifest.
|
| - // Returns the icon url if a suitable icon is found. An empty URL otherwise.
|
| - int FindBestMatchingIcon(
|
| - const std::vector<content::Manifest::Icon>& icons) const;
|
| -
|
| - // Returns whether the |preferred_icon_size_in_pixels_| is in |sizes|.
|
| - bool IconSizesContainsPreferredSize(
|
| - const std::vector<gfx::Size>& sizes) const;
|
| -
|
| - // Returns whether a size bigger than |minimun_icon_size_in_pixels_| is in
|
| - // |sizes|.
|
| - bool IconSizesContainsBiggerThanMinimumSize(
|
| - const std::vector<gfx::Size>& sizes) const;
|
| -
|
| - // Returns an array containing the items in |icons| without the unsupported
|
| - // image MIME types.
|
| - static std::vector<content::Manifest::Icon> FilterIconsByType(
|
| - const std::vector<content::Manifest::Icon>& icons);
|
| -
|
| - // Returns whether the 'any' (ie. gfx::Size(0,0)) is in |sizes|.
|
| - static bool IconSizesContainsAny(const std::vector<gfx::Size>& sizes);
|
| -
|
| - const int ideal_icon_size_in_px_;
|
| - const int minimum_icon_size_in_px_;
|
| -
|
| - friend class ManifestIconSelectorTest;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ManifestIconSelector);
|
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ManifestIconSelector);
|
| };
|
|
|
| #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_
|
|
|