| // Copyright 2023 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "components/webapps/browser/android/webapp_icon.h" |
| #include "components/webapps/browser/android/webapps_icon_utils.h" |
| WebappIcon::WebappIcon(const GURL& icon_url) : url_(icon_url) {} |
| WebappIcon::WebappIcon(const GURL& icon_url, |
| webapk::Image::Usage usage) |
| purpose_(is_maskable ? webapk::Image::MASKABLE : webapk::Image::ANY) { |
| WebappIcon::WebappIcon(const WebappIcon&) = default; |
| WebappIcon& WebappIcon::operator=(const WebappIcon&) = default; |
| WebappIcon::~WebappIcon() = default; |
| void WebappIcon::AddUsage(webapk::Image::Usage usage) { |
| int WebappIcon::GetIdealSizeInPx() const { |
| // The ideal size is the biggest one this icon serves. |
| for (const auto& usage : usages_) { |
| WebappsIconUtils::GetIdealIconSizeForIconType(usage, purpose_)); |