| OLD | NEW |
| 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 #ifndef IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ | 6 #define IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ |
| 7 | 7 |
| 8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
| 9 | 9 |
| 10 // Attributes of a favicon. A favicon is represented either with an image or | 10 // Attributes of a favicon. A favicon is represented either with an image or |
| 11 // with a fallback monogram of a given color and background color. | 11 // with a fallback monogram of a given color and background color. |
| 12 @interface FaviconAttributes : NSObject | 12 @interface FaviconAttributes : NSObject |
| 13 | 13 |
| 14 // Favicon image. Can be nil. If it is nil, monogram string and color are | 14 // Favicon image. Can be nil. If it is nil, monogram string and color are |
| 15 // guaranteed to be not nil. | 15 // guaranteed to be not nil. |
| 16 @property(nonatomic, readonly, strong) UIImage* faviconImage; | 16 @property(nonatomic, readonly, strong, nullable) UIImage* faviconImage; |
| 17 // Favicon monogram. Only available when there is no image. | 17 // Favicon monogram. Only available when there is no image. |
| 18 @property(nonatomic, readonly, copy) NSString* monogramString; | 18 @property(nonatomic, readonly, copy, nullable) NSString* monogramString; |
| 19 // Favicon monogram color. Only available when there is no image. | 19 // Favicon monogram color. Only available when there is no image. |
| 20 @property(nonatomic, readonly, strong) UIColor* textColor; | 20 @property(nonatomic, readonly, strong, nullable) UIColor* textColor; |
| 21 // Favicon monogram background color. Only available when there is no image. | 21 // Favicon monogram background color. Only available when there is no image. |
| 22 @property(nonatomic, readonly, strong) UIColor* backgroundColor; | 22 @property(nonatomic, readonly, strong, nullable) UIColor* backgroundColor; |
| 23 // Whether the background color is the default one.Only available when there is |
| 24 // no image. |
| 25 @property(nonatomic, readonly, assign, getter=isDefaultBackgroundColor) |
| 26 BOOL defaultBackgroundColor; |
| 23 | 27 |
| 24 + (instancetype)attributesWithImage:(UIImage*)image; | 28 + (nullable instancetype)attributesWithImage:(nonnull UIImage*)image; |
| 25 + (instancetype)attributesWithMonogram:(NSString*)monogram | 29 + (nullable instancetype)attributesWithMonogram:(nonnull NSString*)monogram |
| 26 textColor:(UIColor*)textColor | 30 textColor:(nonnull UIColor*)textColor |
| 27 backgroundColor:(UIColor*)backgroundColor; | 31 backgroundColor: |
| 32 (nonnull UIColor*)backgroundColor |
| 33 defaultBackgroundColor:(BOOL)defaultBackgroundColor; |
| 28 | 34 |
| 29 // Designated initializer. Either |image| or all of |textColor|, | 35 - (nullable instancetype)init NS_UNAVAILABLE; |
| 30 // |backgroundColor| and |monogram| must be not nil. | |
| 31 - (instancetype)initWithImage:(UIImage*)image | |
| 32 monogram:(NSString*)monogram | |
| 33 textColor:(UIColor*)textColor | |
| 34 backgroundColor:(UIColor*)backgroundColor | |
| 35 NS_DESIGNATED_INITIALIZER; | |
| 36 - (instancetype)initWithImage:(UIImage*)image; | |
| 37 - (instancetype)initWithMonogram:(NSString*)monogram | |
| 38 textColor:(UIColor*)textColor | |
| 39 backgroundColor:(UIColor*)backgroundColor; | |
| 40 | |
| 41 - (instancetype)init NS_UNAVAILABLE; | |
| 42 @end | 36 @end |
| 43 | 37 |
| 44 #endif // IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ | 38 #endif // IOS_CHROME_BROWSER_UI_FAVICON_FAVICON_ATTRIBUTES_H_ |
| OLD | NEW |