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

Unified Diff: components/favicon_base/fallback_icon_service.cc

Issue 996253002: [Fallback Icons] Refactor FallbackIconService to be a BrowserContext-level singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and reverting small unneeded change. Created 5 years, 9 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: components/favicon_base/fallback_icon_service.cc
diff --git a/components/favicon_base/fallback_icon_service.cc b/components/favicon_base/fallback_icon_service.cc
index adce72e105f6a1fce671c62fb27dabcecfb0ef87..89df7642c6389394d66a878dbecd864e6f69f13a 100644
--- a/components/favicon_base/fallback_icon_service.cc
+++ b/components/favicon_base/fallback_icon_service.cc
@@ -8,6 +8,7 @@
#include "base/i18n/case_conversion.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/favicon/core/browser/fallback_icon_client.h"
#include "components/favicon_base/fallback_icon_style.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -38,8 +39,8 @@ base::string16 GetFallbackIconText(const GURL& url) {
} // namespace
FallbackIconService::FallbackIconService(
- const std::vector<std::string>& font_list)
- : font_list_(font_list) {
+ FallbackIconClient* fallback_icon_client)
+ : fallback_icon_client_(fallback_icon_client) {
}
FallbackIconService::~FallbackIconService() {
@@ -88,7 +89,8 @@ void FallbackIconService::DrawFallbackIcon(const GURL& icon_url,
// TODO(huangs): See how expensive gfx::FontList() is, and possibly cache.
canvas->DrawStringRectWithFlags(
icon_text,
- gfx::FontList(font_list_, gfx::Font::NORMAL, font_size),
+ gfx::FontList(fallback_icon_client_->GetFontNameList(), gfx::Font::NORMAL,
+ font_size),
style.text_color,
gfx::Rect(kOffsetX, kOffsetY, size, size),
gfx::Canvas::TEXT_ALIGN_CENTER);

Powered by Google App Engine
This is Rietveld 408576698