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

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

Issue 1233043003: 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, false))) 43 base::EndsWith(icon.src.ExtractFileName(), kPngExtension,
44 base::CompareCase::INSENSITIVE_ASCII)))
44 continue; 45 continue;
45 46
46 for (const auto& size : icon.sizes) { 47 for (const auto& size : icon.sizes) {
47 if (size.IsEmpty()) // "any" 48 if (size.IsEmpty()) // "any"
48 return true; 49 return true;
49 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize) 50 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize)
50 return true; 51 return true;
51 } 52 }
52 } 53 }
53 54
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return false; 428 return false;
428 } 429 }
429 if (!DoesManifestContainRequiredIcon(manifest)) { 430 if (!DoesManifestContainRequiredIcon(manifest)) {
430 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); 431 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon);
431 return false; 432 return false;
432 } 433 }
433 return true; 434 return true;
434 } 435 }
435 436
436 } // namespace banners 437 } // 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