OLD | NEW |
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/large_icon_service_factory.h" |
10 #include "chrome/browser/history/top_sites_factory.h" | 10 #include "chrome/browser/history/top_sites_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search/instant_io_context.h" | 12 #include "chrome/browser/search/instant_io_context.h" |
13 #include "chrome/browser/search/instant_service_observer.h" | 13 #include "chrome/browser/search/instant_service_observer.h" |
14 #include "chrome/browser/search/most_visited_iframe_source.h" | 14 #include "chrome/browser/search/most_visited_iframe_source.h" |
15 #include "chrome/browser/search/search.h" | 15 #include "chrome/browser/search/search.h" |
16 #include "chrome/browser/search/suggestions/suggestions_source.h" | 16 #include "chrome/browser/search/suggestions/suggestions_source.h" |
17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
19 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 19 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
20 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 20 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
21 #include "chrome/browser/ui/webui/fallback_icon_source.h" | 21 #include "chrome/browser/ui/webui/fallback_icon_source.h" |
22 #include "chrome/browser/ui/webui/favicon_source.h" | 22 #include "chrome/browser/ui/webui/favicon_source.h" |
23 #include "chrome/browser/ui/webui/large_icon_source.h" | 23 #include "chrome/browser/ui/webui/large_icon_source.h" |
24 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 24 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
25 #include "chrome/browser/ui/webui/theme_source.h" | 25 #include "chrome/browser/ui/webui/theme_source.h" |
26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
27 #include "components/favicon/core/fallback_icon_service.h" | 27 #include "components/favicon/core/fallback_icon_service.h" |
28 #include "components/favicon/core/favicon_service.h" | 28 #include "components/favicon/core/large_icon_service.h" |
29 #include "components/history/core/browser/top_sites.h" | 29 #include "components/history/core/browser/top_sites.h" |
30 #include "components/keyed_service/core/service_access_type.h" | 30 #include "components/keyed_service/core/service_access_type.h" |
31 #include "components/search_engines/template_url_service.h" | 31 #include "components/search_engines/template_url_service.h" |
32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
34 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
35 #include "content/public/browser/render_process_host.h" | 35 #include "content/public/browser/render_process_host.h" |
36 #include "content/public/browser/url_data_source.h" | 36 #include "content/public/browser/url_data_source.h" |
37 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
38 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 111 |
112 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled | 112 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled |
113 // on Android. | 113 // on Android. |
114 #if !defined(OS_ANDROID) | 114 #if !defined(OS_ANDROID) |
115 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 115 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
116 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 116 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
117 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 117 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
118 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 118 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
119 #endif // !defined(OS_ANDROID) | 119 #endif // !defined(OS_ANDROID) |
120 | 120 |
121 favicon::FaviconService* favicon_service = | |
122 FaviconServiceFactory::GetForProfile(profile_, | |
123 ServiceAccessType::EXPLICIT_ACCESS); | |
124 favicon::FallbackIconService* fallback_icon_service = | 121 favicon::FallbackIconService* fallback_icon_service = |
125 FallbackIconServiceFactory::GetForBrowserContext(profile_); | 122 FallbackIconServiceFactory::GetForBrowserContext(profile_); |
126 | 123 favicon::LargeIconService* large_icon_service = |
127 content::URLDataSource::Add(profile_, | 124 LargeIconServiceFactory::GetForBrowserContext(profile_); |
128 new LargeIconSource(favicon_service, fallback_icon_service)); | |
129 content::URLDataSource::Add( | 125 content::URLDataSource::Add( |
130 profile_, new FallbackIconSource(fallback_icon_service)); | 126 profile_, new FallbackIconSource(fallback_icon_service)); |
131 content::URLDataSource::Add( | 127 content::URLDataSource::Add( |
132 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 128 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
| 129 content::URLDataSource::Add( |
| 130 profile_, new LargeIconSource(fallback_icon_service, large_icon_service)); |
133 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 131 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
134 content::URLDataSource::Add( | 132 content::URLDataSource::Add( |
135 profile_, new suggestions::SuggestionsSource(profile_)); | 133 profile_, new suggestions::SuggestionsSource(profile_)); |
136 } | 134 } |
137 | 135 |
138 InstantService::~InstantService() { | 136 InstantService::~InstantService() { |
139 if (template_url_service_) | 137 if (template_url_service_) |
140 template_url_service_->RemoveObserver(this); | 138 template_url_service_->RemoveObserver(this); |
141 } | 139 } |
142 | 140 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 } | 458 } |
461 | 459 |
462 void InstantService::ResetInstantSearchPrerenderer() { | 460 void InstantService::ResetInstantSearchPrerenderer() { |
463 if (!chrome::ShouldPrefetchSearchResults()) | 461 if (!chrome::ShouldPrefetchSearchResults()) |
464 return; | 462 return; |
465 | 463 |
466 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 464 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
467 instant_prerenderer_.reset( | 465 instant_prerenderer_.reset( |
468 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); | 466 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); |
469 } | 467 } |
OLD | NEW |