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

Unified Diff: chrome/browser/search/instant_service.cc

Issue 1092873002: [Icons NTP] Refactor large_icon_source to extract the logic shared between desktop and Android to f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search/instant_service.cc
diff --git a/chrome/browser/search/instant_service.cc b/chrome/browser/search/instant_service.cc
index bf75e9a5c75ce7f1de4659b1f5c70591590a9107..794241ff114abc9889023b9240681f817b608d24 100644
--- a/chrome/browser/search/instant_service.cc
+++ b/chrome/browser/search/instant_service.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/favicon/fallback_icon_service_factory.h"
-#include "chrome/browser/favicon/favicon_service_factory.h"
+#include "chrome/browser/favicon/large_icon_service_factory.h"
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/instant_io_context.h"
@@ -16,6 +16,9 @@
#include "chrome/browser/search/suggestions/suggestions_source.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
+#include "chrome/browser/themes/theme_properties.h"
huangs 2015/04/21 05:00:27 Artifact from syncing?
beaudoin 2015/04/21 15:11:11 Artifact from a revert before syncing. Good catch.
+#include "chrome/browser/themes/theme_service.h"
+#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/thumbnails/thumbnail_list_source.h"
#include "chrome/browser/ui/search/instant_search_prerenderer.h"
#include "chrome/browser/ui/webui/fallback_icon_source.h"
@@ -25,7 +28,7 @@
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/render_messages.h"
#include "components/favicon/core/fallback_icon_service.h"
-#include "components/favicon/core/favicon_service.h"
+#include "components/favicon/core/large_icon_service.h"
#include "components/history/core/browser/top_sites.h"
#include "components/keyed_service/core/service_access_type.h"
#include "components/search_engines/template_url_service.h"
@@ -44,11 +47,21 @@
#include "chrome/browser/search/local_ntp_source.h"
#endif
-#if defined(ENABLE_THEMES)
-#include "chrome/browser/themes/theme_properties.h"
-#include "chrome/browser/themes/theme_service.h"
-#include "chrome/browser/themes/theme_service_factory.h"
-#endif // defined(ENABLE_THEMES)
+namespace {
huangs 2015/04/21 05:00:27 Artifact from syncing? Etc.
beaudoin 2015/04/21 15:11:11 Done.
+
+const int kSectionBorderAlphaTransparency = 80;
+
+// Converts SkColor to RGBAColor
+RGBAColor SkColorToRGBAColor(const SkColor& sKColor) {
+ RGBAColor color;
+ color.r = SkColorGetR(sKColor);
+ color.g = SkColorGetG(sKColor);
+ color.b = SkColorGetB(sKColor);
+ color.a = SkColorGetA(sKColor);
+ return color;
+}
+
+} // namespace
InstantService::InstantService(Profile* profile)
: profile_(profile),
@@ -118,18 +131,17 @@ InstantService::InstantService(Profile* profile)
content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_));
#endif // !defined(OS_ANDROID)
- favicon::FaviconService* favicon_service =
- FaviconServiceFactory::GetForProfile(profile_,
- ServiceAccessType::EXPLICIT_ACCESS);
favicon::FallbackIconService* fallback_icon_service =
FallbackIconServiceFactory::GetForBrowserContext(profile_);
+ favicon::LargeIconService* large_icon_service =
+ LargeIconServiceFactory::GetForBrowserContext(profile_);
- content::URLDataSource::Add(profile_,
- new LargeIconSource(favicon_service, fallback_icon_service));
content::URLDataSource::Add(
profile_, new FallbackIconSource(fallback_icon_service));
content::URLDataSource::Add(
profile_, new FaviconSource(profile_, FaviconSource::FAVICON));
+ content::URLDataSource::Add(profile_, new LargeIconSource(
+ fallback_icon_service, large_icon_service));
content::URLDataSource::Add(profile_, new MostVisitedIframeSource());
content::URLDataSource::Add(
profile_, new suggestions::SuggestionsSource(profile_));
@@ -191,14 +203,12 @@ void InstantService::UndoAllMostVisitedDeletions() {
}
void InstantService::UpdateThemeInfo() {
-#if defined(ENABLE_THEMES)
// Update theme background info.
// Initialize |theme_info| if necessary.
if (!theme_info_)
OnThemeChanged(ThemeServiceFactory::GetForProfile(profile_));
else
OnThemeChanged(NULL);
-#endif // defined(ENABLE_THEMES)
}
void InstantService::UpdateMostVisitedItemsInfo() {
@@ -289,24 +299,6 @@ void InstantService::NotifyAboutMostVisitedItems() {
MostVisitedItemsChanged(most_visited_items_));
}
-#if defined(ENABLE_THEMES)
-
-namespace {
-
-const int kSectionBorderAlphaTransparency = 80;
-
-// Converts SkColor to RGBAColor
-RGBAColor SkColorToRGBAColor(const SkColor& sKColor) {
- RGBAColor color;
- color.r = SkColorGetR(sKColor);
- color.g = SkColorGetG(sKColor);
- color.b = SkColorGetB(sKColor);
- color.a = SkColorGetA(sKColor);
- return color;
-}
-
-} // namespace
-
void InstantService::OnThemeChanged(ThemeService* theme_service) {
if (!theme_service) {
DCHECK(theme_info_.get());
@@ -414,7 +406,6 @@ void InstantService::OnThemeChanged(ThemeService* theme_service) {
FOR_EACH_OBSERVER(InstantServiceObserver, observers_,
ThemeInfoChanged(*theme_info_));
}
-#endif // defined(ENABLE_THEMES)
void InstantService::OnTemplateURLServiceChanged() {
// Check whether the default search provider was changed.

Powered by Google App Engine
This is Rietveld 408576698