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

Side by Side Diff: ios/chrome/browser/favicon/favicon_attributes.mm

Issue 2787503002: Move FaviconAttributes to UI (Closed)
Patch Set: Add blank line Created 3 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import "ios/chrome/browser/favicon/favicon_attributes.h"
6
7 #include "base/logging.h"
8
9 #if !defined(__has_feature) || !__has_feature(objc_arc)
10 #error "This file requires ARC support."
11 #endif
12
13 @implementation FaviconAttributes
14 @synthesize faviconImage = _faviconImage;
15 @synthesize monogramString = _monogramString;
16 @synthesize textColor = _textColor;
17 @synthesize backgroundColor = _backgroundColor;
18
19 - (instancetype)initWithImage:(UIImage*)image
20 monogram:(NSString*)monogram
21 textColor:(UIColor*)textColor
22 backgroundColor:(UIColor*)backgroundColor {
23 DCHECK(image || (monogram && textColor && backgroundColor));
24 self = [super init];
25 if (self) {
26 _faviconImage = image;
27 _monogramString = [monogram copy];
28 _textColor = textColor;
29 _backgroundColor = backgroundColor;
30 }
31
32 return self;
33 }
34
35 - (instancetype)initWithImage:(UIImage*)image {
36 DCHECK(image);
37 return
38 [self initWithImage:image monogram:nil textColor:nil backgroundColor:nil];
39 }
40
41 - (instancetype)initWithMonogram:(NSString*)monogram
42 textColor:(UIColor*)textColor
43 backgroundColor:(UIColor*)backgroundColor {
44 DCHECK(monogram && textColor && backgroundColor);
45 return [self initWithImage:nil
46 monogram:monogram
47 textColor:textColor
48 backgroundColor:backgroundColor];
49 }
50
51 + (instancetype)attributesWithImage:(UIImage*)image {
52 return [[self alloc] initWithImage:image];
53 }
54
55 + (instancetype)attributesWithMonogram:(NSString*)monogram
56 textColor:(UIColor*)textColor
57 backgroundColor:(UIColor*)backgroundColor {
58 return [[self alloc] initWithMonogram:monogram
59 textColor:textColor
60 backgroundColor:backgroundColor];
61 }
62
63 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/favicon/favicon_attributes.h ('k') | ios/chrome/browser/favicon/favicon_attributes_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698