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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/search/instant_service.h" 5 #include "chrome/browser/search/instant_service.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/favicon/fallback_icon_service_factory.h" 8 #include "chrome/browser/favicon/fallback_icon_service_factory.h"
9 #include "chrome/browser/favicon/favicon_service_factory.h" 9 #include "chrome/browser/favicon/favicon_service_factory.h"
10 #include "chrome/browser/favicon/large_icon_service_factory.h"
10 #include "chrome/browser/history/top_sites_factory.h" 11 #include "chrome/browser/history/top_sites_factory.h"
11 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search/instant_io_context.h" 13 #include "chrome/browser/search/instant_io_context.h"
13 #include "chrome/browser/search/instant_service_observer.h" 14 #include "chrome/browser/search/instant_service_observer.h"
14 #include "chrome/browser/search/most_visited_iframe_source.h" 15 #include "chrome/browser/search/most_visited_iframe_source.h"
15 #include "chrome/browser/search/search.h" 16 #include "chrome/browser/search/search.h"
16 #include "chrome/browser/search/suggestions/suggestions_source.h" 17 #include "chrome/browser/search/suggestions/suggestions_source.h"
17 #include "chrome/browser/search_engines/template_url_service_factory.h" 18 #include "chrome/browser/search_engines/template_url_service_factory.h"
18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 19 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
19 #include "chrome/browser/thumbnails/thumbnail_list_source.h" 20 #include "chrome/browser/thumbnails/thumbnail_list_source.h"
20 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 21 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
21 #include "chrome/browser/ui/webui/fallback_icon_source.h" 22 #include "chrome/browser/ui/webui/fallback_icon_source.h"
22 #include "chrome/browser/ui/webui/favicon_source.h" 23 #include "chrome/browser/ui/webui/favicon_source.h"
23 #include "chrome/browser/ui/webui/large_icon_source.h" 24 #include "chrome/browser/ui/webui/large_icon_source.h"
24 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" 25 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
25 #include "chrome/browser/ui/webui/theme_source.h" 26 #include "chrome/browser/ui/webui/theme_source.h"
26 #include "chrome/common/render_messages.h" 27 #include "chrome/common/render_messages.h"
27 #include "components/favicon/core/fallback_icon_service.h" 28 #include "components/favicon/core/fallback_icon_service.h"
28 #include "components/favicon/core/favicon_service.h" 29 #include "components/favicon/core/favicon_service.h"
30 #include "components/favicon/core/large_icon_service.h"
29 #include "components/history/core/browser/top_sites.h" 31 #include "components/history/core/browser/top_sites.h"
30 #include "components/keyed_service/core/service_access_type.h" 32 #include "components/keyed_service/core/service_access_type.h"
31 #include "components/search_engines/template_url_service.h" 33 #include "components/search_engines/template_url_service.h"
32 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_types.h" 36 #include "content/public/browser/notification_types.h"
35 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
36 #include "content/public/browser/url_data_source.h" 38 #include "content/public/browser/url_data_source.h"
37 #include "grit/theme_resources.h" 39 #include "grit/theme_resources.h"
38 #include "third_party/skia/include/core/SkColor.h" 40 #include "third_party/skia/include/core/SkColor.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); 118 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false));
117 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); 119 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true));
118 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); 120 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_));
119 #endif // !defined(OS_ANDROID) 121 #endif // !defined(OS_ANDROID)
120 122
121 favicon::FaviconService* favicon_service = 123 favicon::FaviconService* favicon_service =
122 FaviconServiceFactory::GetForProfile(profile_, 124 FaviconServiceFactory::GetForProfile(profile_,
123 ServiceAccessType::EXPLICIT_ACCESS); 125 ServiceAccessType::EXPLICIT_ACCESS);
124 favicon::FallbackIconService* fallback_icon_service = 126 favicon::FallbackIconService* fallback_icon_service =
125 FallbackIconServiceFactory::GetForBrowserContext(profile_); 127 FallbackIconServiceFactory::GetForBrowserContext(profile_);
128 favicon::LargeIconService* large_icon_service =
129 LargeIconServiceFactory::GetForBrowserContext(profile_);
126 130
127 content::URLDataSource::Add(profile_, 131 content::URLDataSource::Add(profile_, new LargeIconSource(
huangs 2015/04/20 19:50:25 NIT: inconsistent ordering; move this after Favico
beaudoin 2015/04/21 00:15:38 Done.
128 new LargeIconSource(favicon_service, fallback_icon_service)); 132 favicon_service, fallback_icon_service, large_icon_service));
129 content::URLDataSource::Add( 133 content::URLDataSource::Add(
130 profile_, new FallbackIconSource(fallback_icon_service)); 134 profile_, new FallbackIconSource(fallback_icon_service));
131 content::URLDataSource::Add( 135 content::URLDataSource::Add(
132 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); 136 profile_, new FaviconSource(profile_, FaviconSource::FAVICON));
133 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); 137 content::URLDataSource::Add(profile_, new MostVisitedIframeSource());
134 content::URLDataSource::Add( 138 content::URLDataSource::Add(
135 profile_, new suggestions::SuggestionsSource(profile_)); 139 profile_, new suggestions::SuggestionsSource(profile_));
136 } 140 }
137 141
138 InstantService::~InstantService() { 142 InstantService::~InstantService() {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 } 464 }
461 465
462 void InstantService::ResetInstantSearchPrerenderer() { 466 void InstantService::ResetInstantSearchPrerenderer() {
463 if (!chrome::ShouldPrefetchSearchResults()) 467 if (!chrome::ShouldPrefetchSearchResults())
464 return; 468 return;
465 469
466 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); 470 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_));
467 instant_prerenderer_.reset( 471 instant_prerenderer_.reset(
468 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); 472 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL);
469 } 473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698