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

Side by Side Diff: ios/chrome/browser/ui/favicon/favicon_attributes_provider.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 unified diff | Download patch
OLDNEW
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 #import "ios/chrome/browser/ui/favicon/favicon_attributes_provider.h" 5 #import "ios/chrome/browser/ui/favicon/favicon_attributes_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/mac/bind_objc_block.h" 8 #include "base/mac/bind_objc_block.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 [UIImage imageWithData:[NSData dataWithBytes:data->front() 60 [UIImage imageWithData:[NSData dataWithBytes:data->front()
61 length:data->size()]]; 61 length:data->size()]];
62 attributes = [FaviconAttributes attributesWithImage:favicon]; 62 attributes = [FaviconAttributes attributesWithImage:favicon];
63 } else if (result.fallback_icon_style) { 63 } else if (result.fallback_icon_style) {
64 UIColor* backgroundColor = skia::UIColorFromSkColor( 64 UIColor* backgroundColor = skia::UIColorFromSkColor(
65 result.fallback_icon_style->background_color); 65 result.fallback_icon_style->background_color);
66 UIColor* textColor = 66 UIColor* textColor =
67 skia::UIColorFromSkColor(result.fallback_icon_style->text_color); 67 skia::UIColorFromSkColor(result.fallback_icon_style->text_color);
68 NSString* monogram = 68 NSString* monogram =
69 base::SysUTF16ToNSString(favicon::GetFallbackIconText(blockURL)); 69 base::SysUTF16ToNSString(favicon::GetFallbackIconText(blockURL));
70 attributes = 70 attributes = [FaviconAttributes
71 [FaviconAttributes attributesWithMonogram:monogram 71 attributesWithMonogram:monogram
72 textColor:textColor 72 textColor:textColor
73 backgroundColor:backgroundColor]; 73 backgroundColor:backgroundColor
74 defaultBackgroundColor:result.fallback_icon_style->
75 is_default_background_color];
74 } 76 }
75 DCHECK(attributes); 77 DCHECK(attributes);
76 completion(attributes); 78 completion(attributes);
77 }; 79 };
78 80
79 // Always call LargeIconService in case the favicon was updated. 81 // Always call LargeIconService in case the favicon was updated.
80 CGFloat faviconSize = [UIScreen mainScreen].scale * self.faviconSize; 82 CGFloat faviconSize = [UIScreen mainScreen].scale * self.faviconSize;
81 CGFloat minFaviconSize = [UIScreen mainScreen].scale * self.minSize; 83 CGFloat minFaviconSize = [UIScreen mainScreen].scale * self.minSize;
82 self.largeIconService->GetLargeIconOrFallbackStyle( 84 self.largeIconService->GetLargeIconOrFallbackStyle(
83 URL, minFaviconSize, faviconSize, base::BindBlockArc(faviconBlock), 85 URL, minFaviconSize, faviconSize, base::BindBlockArc(faviconBlock),
84 &_faviconTaskTracker); 86 &_faviconTaskTracker);
85 } 87 }
86 @end 88 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698