Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4460)

Unified Diff: chrome/browser/installable/installable_manager.cc

Issue 2642233002: Require WebApp & WebAPK primary icons to have IconPurpose::ANY (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/installable/installable_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | chrome/browser/installable/installable_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698