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

Side by Side Diff: chrome/browser/manifest/manifest_icon_selector.h

Issue 1308533006: webapps: allow callers of icon downloader/selector to specify a minimum size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-splashscreen-icon
Patch Set: Address review comments Created 5 years, 3 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 #ifndef CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ 5 #ifndef CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_
6 #define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ 6 #define CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/public/common/manifest.h" 9 #include "content/public/common/manifest.h"
10 #include "url/gurl.h" 10 #include "url/gurl.h"
(...skipping 15 matching lines...) Expand all
26 class ManifestIconSelector { 26 class ManifestIconSelector {
27 public: 27 public:
28 // Runs the algorithm to find the best matching icon in the icons listed in 28 // Runs the algorithm to find the best matching icon in the icons listed in
29 // the Manifest. 29 // the Manifest.
30 // 30 //
31 // Size is defined in Android's density-independent pixels (dp): 31 // Size is defined in Android's density-independent pixels (dp):
32 // http://developer.android.com/guide/practices/screens_support.html 32 // http://developer.android.com/guide/practices/screens_support.html
33 // If/when this class is generalized, it may be a good idea to switch this to 33 // If/when this class is generalized, it may be a good idea to switch this to
34 // taking in pixels, instead. 34 // taking in pixels, instead.
35 // 35 //
36 // The icon returned will have a minimum size of an image one density bucket 36 // Any icon returned will have a minimum size as specified by
37 // smaller than the device denisity * preferred_icon_size_in_dp. 37 // |minimum_icon_size_in_dp|.
38 // 38 //
39 // Returns the icon url if a suitable icon is found. An empty URL otherwise. 39 // Returns the icon url if a suitable icon is found. An empty URL otherwise.
40 static GURL FindBestMatchingIcon( 40 static GURL FindBestMatchingIcon(
41 const std::vector<content::Manifest::Icon>& icons, 41 const std::vector<content::Manifest::Icon>& icons,
42 int ideal_icon_size_in_dp, 42 int ideal_icon_size_in_dp,
43 int minimum_icon_size_in_dp,
43 const gfx::Screen* screen); 44 const gfx::Screen* screen);
44 45
45 private: 46 private:
46 ManifestIconSelector(int ideal_icon_size_in_px, 47 ManifestIconSelector(int ideal_icon_size_in_px,
47 int minimum_icon_size_in_px); 48 int minimum_icon_size_in_px);
48 virtual ~ManifestIconSelector() {} 49 virtual ~ManifestIconSelector() {}
49 50
50 // Runs the algorithm to find the best matching icon in the icons listed in 51 // Runs the algorithm to find the best matching icon in the icons listed in
51 // the Manifest. 52 // the Manifest.
52 // Returns the icon url if a suitable icon is found. An empty URL otherwise. 53 // Returns the icon url if a suitable icon is found. An empty URL otherwise.
(...skipping 27 matching lines...) Expand all
80 81
81 const int ideal_icon_size_in_px_; 82 const int ideal_icon_size_in_px_;
82 const int minimum_icon_size_in_px_; 83 const int minimum_icon_size_in_px_;
83 84
84 friend class ManifestIconSelectorTest; 85 friend class ManifestIconSelectorTest;
85 86
86 DISALLOW_COPY_AND_ASSIGN(ManifestIconSelector); 87 DISALLOW_COPY_AND_ASSIGN(ManifestIconSelector);
87 }; 88 };
88 89
89 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ 90 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698