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

Side by Side Diff: chrome/browser/installable/installable_manager.cc

Issue 2452603004: Update comments in InstallableManager. (Closed)
Patch Set: Addressing comments Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/installable/installable_manager.h" 5 #include "chrome/browser/installable/installable_manager.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 "chrome/browser/manifest/manifest_icon_downloader.h" 9 #include "chrome/browser/manifest/manifest_icon_downloader.h"
10 #include "chrome/browser/manifest/manifest_icon_selector.h" 10 #include "chrome/browser/manifest/manifest_icon_selector.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/browser_context.h" 12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/navigation_handle.h" 14 #include "content/public/browser/navigation_handle.h"
15 #include "content/public/browser/service_worker_context.h" 15 #include "content/public/browser/service_worker_context.h"
16 #include "content/public/browser/storage_partition.h" 16 #include "content/public/browser/storage_partition.h"
17 #include "third_party/WebKit/public/platform/WebDisplayMode.h" 17 #include "third_party/WebKit/public/platform/WebDisplayMode.h"
18 18
19 namespace { 19 namespace {
20 20
21 const char kPngExtension[] = ".png"; 21 const char kPngExtension[] = ".png";
22 22
23 // This constant is the icon size on Android (48dp) multiplied by the scale 23 // This constant is the icon size on Android (48dp) multiplied by the scale
24 // factor of a Nexus 5 device (3x). For mobile and desktop platforms, a 144px 24 // factor of a Nexus 5 device (3x). For mobile and desktop platforms, a 144px
25 // icon is an approximate, appropriate lower bound. 25 // icon is an approximate, appropriate lower bound. It is the currently
26 // advertised minimum icon size for triggering banners.
26 // TODO(dominickn): consolidate with minimum_icon_size_in_dp across platforms. 27 // TODO(dominickn): consolidate with minimum_icon_size_in_dp across platforms.
27 const int kIconMinimumSizeInPx = 144; 28 const int kIconMinimumSizeInPx = 144;
28 29
29 // Returns true if |manifest| specifies a PNG icon >= 144x144px (or size "any"). 30 // Returns true if |manifest| specifies a PNG icon >= 144x144px (or size "any").
30 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) { 31 bool DoesManifestContainRequiredIcon(const content::Manifest& manifest) {
31 for (const auto& icon : manifest.icons) { 32 for (const auto& icon : manifest.icons) {
32 // The type field is optional. If it isn't present, fall back on checking 33 // The type field is optional. If it isn't present, fall back on checking
33 // the src extension, and allow the icon if the extension ends with png. 34 // the src extension, and allow the icon if the extension ends with png.
34 if (!base::EqualsASCII(icon.type, "image/png") && 35 if (!base::EqualsASCII(icon.type, "image/png") &&
35 !(icon.type.empty() && base::EndsWith( 36 !(icon.type.empty() && base::EndsWith(
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 return manifest_->url; 436 return manifest_->url;
436 } 437 }
437 438
438 const content::Manifest& InstallableManager::manifest() const { 439 const content::Manifest& InstallableManager::manifest() const {
439 return manifest_->manifest; 440 return manifest_->manifest;
440 } 441 }
441 442
442 bool InstallableManager::is_installable() const { 443 bool InstallableManager::is_installable() const {
443 return installable_->installable; 444 return installable_->installable;
444 } 445 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698