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

Unified Diff: ios/chrome/browser/ui/favicon/favicon_attributes.mm

Issue 2890193003: Open Most Visited items (Closed)
Patch Set: Fix showcase Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/favicon/favicon_attributes.mm
diff --git a/ios/chrome/browser/ui/favicon/favicon_attributes.mm b/ios/chrome/browser/ui/favicon/favicon_attributes.mm
index 10d9aeb3e4c28619a59f602a2c2b7e2a9b0492d6..8142a2e3efdc1561ca756aa03d70dd0a4baef0c1 100644
--- a/ios/chrome/browser/ui/favicon/favicon_attributes.mm
+++ b/ios/chrome/browser/ui/favicon/favicon_attributes.mm
@@ -15,11 +15,15 @@
@synthesize monogramString = _monogramString;
@synthesize textColor = _textColor;
@synthesize backgroundColor = _backgroundColor;
+@synthesize defaultBackgroundColor = _defaultBackgroundColor;
+// Designated initializer. Either |image| or all of |textColor|,
+// |backgroundColor| and |monogram| must be not nil.
- (instancetype)initWithImage:(UIImage*)image
monogram:(NSString*)monogram
textColor:(UIColor*)textColor
- backgroundColor:(UIColor*)backgroundColor {
+ backgroundColor:(UIColor*)backgroundColor
+ defaultBackgroundColor:(BOOL)defaultBackgroundColor {
DCHECK(image || (monogram && textColor && backgroundColor));
self = [super init];
if (self) {
@@ -27,37 +31,30 @@
_monogramString = [monogram copy];
_textColor = textColor;
_backgroundColor = backgroundColor;
+ _defaultBackgroundColor = defaultBackgroundColor;
}
return self;
}
-- (instancetype)initWithImage:(UIImage*)image {
- DCHECK(image);
- return
- [self initWithImage:image monogram:nil textColor:nil backgroundColor:nil];
-}
-
-- (instancetype)initWithMonogram:(NSString*)monogram
- textColor:(UIColor*)textColor
- backgroundColor:(UIColor*)backgroundColor {
- DCHECK(monogram && textColor && backgroundColor);
- return [self initWithImage:nil
- monogram:monogram
- textColor:textColor
- backgroundColor:backgroundColor];
-}
-
+ (instancetype)attributesWithImage:(UIImage*)image {
- return [[self alloc] initWithImage:image];
+ DCHECK(image);
+ return [[self alloc] initWithImage:image
+ monogram:nil
+ textColor:nil
+ backgroundColor:nil
+ defaultBackgroundColor:NO];
}
+ (instancetype)attributesWithMonogram:(NSString*)monogram
textColor:(UIColor*)textColor
- backgroundColor:(UIColor*)backgroundColor {
- return [[self alloc] initWithMonogram:monogram
- textColor:textColor
- backgroundColor:backgroundColor];
+ backgroundColor:(UIColor*)backgroundColor
+ defaultBackgroundColor:(BOOL)defaultBackgroundColor {
+ return [[self alloc] initWithImage:nil
+ monogram:monogram
+ textColor:textColor
+ backgroundColor:backgroundColor
+ defaultBackgroundColor:defaultBackgroundColor];
}
@end
« no previous file with comments | « ios/chrome/browser/ui/favicon/favicon_attributes.h ('k') | ios/chrome/browser/ui/favicon/favicon_attributes_provider.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698