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

Side by Side Diff: chrome/browser/banners/app_banner_data_fetcher.cc

Issue 1233453011: Revert of Remove some legacy versions of StartsWith and EndsWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
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 #include "chrome/browser/banners/app_banner_data_fetcher.h" 5 #include "chrome/browser/banners/app_banner_data_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/banners/app_banner_debug_log.h" 10 #include "chrome/browser/banners/app_banner_debug_log.h"
(...skipping 22 matching lines...) Expand all
33 const char kPngExtension[] = ".png"; 33 const char kPngExtension[] = ".png";
34 34
35 // The requirement for now is an image/png that is at least 144x144. 35 // The requirement for now is an image/png that is at least 144x144.
36 const int kIconMinimumSize = 144; 36 const int kIconMinimumSize = 144;
37 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { 37 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) {
38 for (const auto& icon : manifest.icons) { 38 for (const auto& icon : manifest.icons) {
39 // The type field is optional. If it isn't present, fall back on checking 39 // The type field is optional. If it isn't present, fall back on checking
40 // the src extension, and allow the icon if the extension ends with png. 40 // the src extension, and allow the icon if the extension ends with png.
41 if (!base::EqualsASCII(icon.type.string(), "image/png") && 41 if (!base::EqualsASCII(icon.type.string(), "image/png") &&
42 !(icon.type.is_null() && 42 !(icon.type.is_null() &&
43 base::EndsWith(icon.src.ExtractFileName(), kPngExtension, 43 base::EndsWith(icon.src.ExtractFileName(), kPngExtension, false)))
44 base::CompareCase::INSENSITIVE_ASCII)))
45 continue; 44 continue;
46 45
47 for (const auto& size : icon.sizes) { 46 for (const auto& size : icon.sizes) {
48 if (size.IsEmpty()) // "any" 47 if (size.IsEmpty()) // "any"
49 return true; 48 return true;
50 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize) 49 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize)
51 return true; 50 return true;
52 } 51 }
53 } 52 }
54 53
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 return false; 427 return false;
429 } 428 }
430 if (!DoesManifestContainRequiredIcon(manifest)) { 429 if (!DoesManifestContainRequiredIcon(manifest)) {
431 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); 430 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon);
432 return false; 431 return false;
433 } 432 }
434 return true; 433 return true;
435 } 434 }
436 435
437 } // namespace banners 436 } // namespace banners
OLDNEW
« no previous file with comments | « chrome/app/delay_load_hook_win.cc ('k') | chrome/browser/chromeos/extensions/wallpaper_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698