OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 base::TimeDelta gTimeDeltaForTesting; | 31 base::TimeDelta gTimeDeltaForTesting; |
32 int gCurrentRequestID = -1; | 32 int gCurrentRequestID = -1; |
33 | 33 |
34 // The requirement for now is an image/png that is at least 144x144. | 34 // The requirement for now is an image/png that is at least 144x144. |
35 const int kIconMinimumSize = 144; | 35 const int kIconMinimumSize = 144; |
36 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { | 36 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { |
37 for (const auto& icon : manifest.icons) { | 37 for (const auto& icon : manifest.icons) { |
38 if (!EqualsASCII(icon.type.string(), "image/png")) | 38 if (!base::EqualsASCII(icon.type.string(), "image/png")) |
39 continue; | 39 continue; |
40 | 40 |
41 for (const auto& size : icon.sizes) { | 41 for (const auto& size : icon.sizes) { |
42 if (size.IsEmpty()) // "any" | 42 if (size.IsEmpty()) // "any" |
43 return true; | 43 return true; |
44 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize) | 44 if (size.width() >= kIconMinimumSize && size.height() >= kIconMinimumSize) |
45 return true; | 45 return true; |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 return false; | 376 return false; |
377 } | 377 } |
378 if (!DoesManifestContainRequiredIcon(manifest)) { | 378 if (!DoesManifestContainRequiredIcon(manifest)) { |
379 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); | 379 OutputDeveloperNotShownMessage(web_contents, kManifestMissingSuitableIcon); |
380 return false; | 380 return false; |
381 } | 381 } |
382 return true; | 382 return true; |
383 } | 383 } |
384 | 384 |
385 } // namespace banners | 385 } // namespace banners |
OLD | NEW |