| // Copyright 2012 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #ifndef CHROME_BROWSER_WEB_APPLICATIONS_OS_INTEGRATION_MAC_ICON_UTILS_H_ |
| #define CHROME_BROWSER_WEB_APPLICATIONS_OS_INTEGRATION_MAC_ICON_UTILS_H_ |
| |
| #include "base/auto_reset.h" |
| |
| #ifdef __OBJC__ |
| @class NSImage; |
| @class NSImageRep; |
| #endif |
| |
| namespace gfx { |
| class Image; |
| } |
| |
| namespace web_app { |
| |
| // Creates a masked icon image from a base icon image. Without resizing |
| // `base_icon`, returns an icon masked to a rounded rect according to Apple |
| // design templates. |
| gfx::Image CreateAppleMaskedAppIcon(const gfx::Image& base_icon); |
| |
| #ifdef __OBJC__ |
| // Check if an icon has a solid color border |
| bool HasSolidColorBorder(const gfx::Image& icon); |
| |
| // Creates a masked icon image from a base icon image. This mask is only |
| // for the DIY app. After resizing, adding a white background, and masking |
| // the icon, returns an icon masked to a rounded rect according to Apple |
| // design templates. |
| gfx::Image MaskDiyAppIcon(const gfx::Image& base_icon); |
| |
| // Creates a canvas the same size as `overlay`, copies the appropriate |
| // representation from `background` into it (according to Cocoa), then draws |
| // `overlay` over it using NSCompositingOperationSourceOver. |
| NSImageRep* OverlayImageRep(NSImage* background, NSImageRep* overlay); |
| #endif |
| |
| namespace testing { |
| // Sets whether icon masking should be disabled for testing purposes. |
| [[nodiscard]] base::AutoReset<bool> SetDisableIconMaskingForTesting( |
| bool disabled); |
| } // namespace testing |
| |
| } // namespace web_app |
| |
| #endif // CHROME_BROWSER_WEB_APPLICATIONS_OS_INTEGRATION_MAC_ICON_UTILS_H_ |