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

Unified Diff: chrome/browser/ui/webui/large_icon_source.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 merge. 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: chrome/browser/ui/webui/large_icon_source.cc
diff --git a/chrome/browser/ui/webui/large_icon_source.cc b/chrome/browser/ui/webui/large_icon_source.cc
index e28d342c0af64f56f1de1403d5bc90ec7e7a3467..79b1e0abf5d60ef2c49691092a27d479c30c48c3 100644
--- a/chrome/browser/ui/webui/large_icon_source.cc
+++ b/chrome/browser/ui/webui/large_icon_source.cc
@@ -4,21 +4,17 @@
#include "chrome/browser/ui/webui/large_icon_source.h"
-#include <string>
#include <vector>
#include "base/memory/ref_counted_memory.h"
-#include "chrome/browser/favicon/favicon_service_factory.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/instant_io_context.h"
#include "chrome/common/favicon/large_icon_url_parser.h"
#include "chrome/common/url_constants.h"
+#include "components/favicon/core/fallback_icon_service.h"
#include "components/favicon/core/favicon_service.h"
#include "components/favicon_base/fallback_icon_style.h"
-#include "grit/platform_locale_settings.h"
#include "net/url_request/url_request.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/l10n/l10n_util.h"
namespace {
@@ -42,16 +38,12 @@ LargeIconSource::IconRequest::IconRequest(
LargeIconSource::IconRequest::~IconRequest() {
}
-LargeIconSource::LargeIconSource(Profile* profile) : profile_(profile) {
- std::vector<std::string> font_list;
-#if defined(OS_CHROMEOS)
- font_list.push_back("Noto Sans");
-#elif defined(OS_IOS)
- font_list.push_back("Helvetica Neue");
-#else
- font_list.push_back(l10n_util::GetStringUTF8(IDS_SANS_SERIF_FONT_FAMILY));
-#endif
- fallback_icon_service_.reset(new FallbackIconService(font_list));
+LargeIconSource::LargeIconSource(FaviconService* favicon_service,
+ FallbackIconService* fallback_icon_service)
+ : favicon_service_(favicon_service),
+ fallback_icon_service_(fallback_icon_service) {
+ DCHECK(favicon_service_);
+ DCHECK(fallback_icon_service_);
}
LargeIconSource::~LargeIconSource() {
@@ -74,20 +66,13 @@ void LargeIconSource::StartDataRequest(
return;
}
- FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
- profile_, ServiceAccessType::EXPLICIT_ACCESS);
- if (!favicon_service) {
- SendNotFoundResponse(callback);
- return;
- }
-
GURL url(parser.url_string());
if (!url.is_valid()) {
SendNotFoundResponse(callback);
return;
}
- favicon_service->GetRawFaviconForPageURL(
+ favicon_service_->GetRawFaviconForPageURL(
url,
favicon_base::TOUCH_ICON | favicon_base::TOUCH_PRECOMPOSED_ICON,
parser.size_in_pixels(),

Powered by Google App Engine
This is Rietveld 408576698