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

Unified Diff: chrome/browser/ui/webui/browsing_history_handler.cc

Issue 1596273003: [Android] Use fallback icon if there is no large favicon on the history page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/browsing_history_handler.cc
diff --git a/chrome/browser/ui/webui/browsing_history_handler.cc b/chrome/browser/ui/webui/browsing_history_handler.cc
index fbcdc981cd8b46c3676f316b8d8ec66d234b545e..7a61067496532e356ca2d49e3d7201490556dd1a 100644
--- a/chrome/browser/ui/webui/browsing_history_handler.cc
+++ b/chrome/browser/ui/webui/browsing_history_handler.cc
@@ -22,6 +22,8 @@
#include "chrome/browser/banners/app_banner_settings_helper.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/engagement/site_engagement_service.h"
+#include "chrome/browser/favicon/fallback_icon_service_factory.h"
+#include "chrome/browser/favicon/large_icon_service_factory.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/history_utils.h"
#include "chrome/browser/history/web_history_service_factory.h"
@@ -30,11 +32,15 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/webui/favicon_source.h"
+#include "chrome/browser/ui/webui/large_icon_source.h"
#include "chrome/common/features.h"
#include "chrome/common/pref_names.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/browser_sync/browser/profile_sync_service.h"
+#include "components/favicon/core/fallback_icon_service.h"
+#include "components/favicon/core/fallback_url_util.h"
+#include "components/favicon/core/large_icon_service.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/browser/web_history_service.h"
@@ -220,6 +226,11 @@ scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue(
// HistoryEntry. Please update it whenever you add or remove
// any keys in result.
result->SetString("domain", domain);
+
+ result->SetString(
+ "fallbackFaviconText",
+ base::UTF16ToASCII(favicon::GetFallbackIconText(url)));
+
result->SetDouble("time", time.ToJsTime());
// Pass the timestamps in a list.
@@ -296,8 +307,18 @@ BrowsingHistoryHandler::~BrowsingHistoryHandler() {
void BrowsingHistoryHandler::RegisterMessages() {
// Create our favicon data source.
Profile* profile = Profile::FromWebUI(web_ui());
+
+#if defined(OS_ANDROID)
+ favicon::FallbackIconService* fallback_icon_service =
+ FallbackIconServiceFactory::GetForBrowserContext(profile);
+ favicon::LargeIconService* large_icon_service =
+ LargeIconServiceFactory::GetForBrowserContext(profile);
+ content::URLDataSource::Add(
+ profile, new LargeIconSource(fallback_icon_service, large_icon_service));
+#else
content::URLDataSource::Add(
profile, new FaviconSource(profile, FaviconSource::ANY));
+#endif
// Get notifications when history is cleared.
history::HistoryService* hs = HistoryServiceFactory::GetForProfile(

Powered by Google App Engine
This is Rietveld 408576698