| 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 #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/macros.h" | 8 #include "base/macros.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 22 matching lines...) Expand all Loading... |
| 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 // Any icon returned will be close as possible to |ideal_icon_size_in_dp| | 36 // Any icon returned will be close as possible to |ideal_icon_size_in_dp| |
| 37 // with a size not less than |minimum_icon_size_in_dp|. | 37 // with a size not less than |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 int minimum_icon_size_in_dp); |
| 44 const gfx::Screen* screen); | |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 ManifestIconSelector(int ideal_icon_size_in_px, | 46 ManifestIconSelector(int ideal_icon_size_in_px, |
| 48 int minimum_icon_size_in_px); | 47 int minimum_icon_size_in_px); |
| 49 virtual ~ManifestIconSelector() {} | 48 virtual ~ManifestIconSelector() {} |
| 50 | 49 |
| 51 // Runs the algorithm to find the best matching icon in the icons listed in | 50 // Runs the algorithm to find the best matching icon in the icons listed in |
| 52 // the Manifest. | 51 // the Manifest. |
| 53 // Returns the icon url if a suitable icon is found. An empty URL otherwise. | 52 // Returns the icon url if a suitable icon is found. An empty URL otherwise. |
| 54 int FindBestMatchingIcon( | 53 int FindBestMatchingIcon( |
| (...skipping 26 matching lines...) Expand all Loading... |
| 81 | 80 |
| 82 const int ideal_icon_size_in_px_; | 81 const int ideal_icon_size_in_px_; |
| 83 const int minimum_icon_size_in_px_; | 82 const int minimum_icon_size_in_px_; |
| 84 | 83 |
| 85 friend class ManifestIconSelectorTest; | 84 friend class ManifestIconSelectorTest; |
| 86 | 85 |
| 87 DISALLOW_COPY_AND_ASSIGN(ManifestIconSelector); | 86 DISALLOW_COPY_AND_ASSIGN(ManifestIconSelector); |
| 88 }; | 87 }; |
| 89 | 88 |
| 90 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ | 89 #endif // CHROME_BROWSER_MANIFEST_MANIFEST_ICON_SELECTOR_H_ |
| OLD | NEW |