Chromium Code Reviews| Index: chrome/browser/installable/installable_manager.cc |
| diff --git a/chrome/browser/installable/installable_manager.cc b/chrome/browser/installable/installable_manager.cc |
| index 1e0618691ead5ef36d216bf862cac37da25ea6c5..8840d3a50b0d47d0d56a8967f1b9894d8f8b3eba 100644 |
| --- a/chrome/browser/installable/installable_manager.cc |
| +++ b/chrome/browser/installable/installable_manager.cc |
| @@ -19,6 +19,8 @@ |
| #include "net/base/url_util.h" |
| #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
| +using IconPurpose = content::Manifest::Icon::IconPurpose; |
| + |
| namespace { |
| const char kPngExtension[] = ".png"; |
| @@ -30,6 +32,15 @@ const char kPngExtension[] = ".png"; |
| // TODO(dominickn): consolidate with minimum_icon_size_in_px across platforms. |
| const int kIconMinimumSizeInPx = 144; |
| +// Returns true if |icon| has icon purpose |purpose|. |
| +bool HasIconPurpose(const content::Manifest::Icon& icon, IconPurpose purpose) { |
| + for (IconPurpose icon_purpose : icon.purpose) { |
|
dominickn
2017/01/19 23:29:20
return std::find(icon.purpose.begin(), icon.purpos
F
2017/01/20 00:36:01
Done.
|
| + if (icon_purpose == purpose) |
| + return true; |
| + } |
| + return false; |
| +} |
| + |
| // Returns true if |manifest| specifies a PNG icon >= 144x144px (or size "any"). |
| bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { |
| for (const auto& icon : manifest.icons) { |
| @@ -41,6 +52,8 @@ bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { |
| base::CompareCase::INSENSITIVE_ASCII))) |
| continue; |
| + if (!HasIconPurpose(icon, IconPurpose::ANY)) |
|
dominickn
2017/01/19 23:29:20
Nit: newline after continue
F
2017/01/20 00:36:01
Done.
|
| + continue; |
| for (const auto& size : icon.sizes) { |
| if (size.IsEmpty()) // "any" |
| return true; |