Chromium Code Reviews| 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" | |
| 9 #include "chrome/browser/favicon/favicon_service_factory.h" | |
| 8 #include "chrome/browser/history/top_sites_factory.h" | 10 #include "chrome/browser/history/top_sites_factory.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/instant_io_context.h" | 12 #include "chrome/browser/search/instant_io_context.h" |
| 11 #include "chrome/browser/search/instant_service_observer.h" | 13 #include "chrome/browser/search/instant_service_observer.h" |
| 12 #include "chrome/browser/search/most_visited_iframe_source.h" | 14 #include "chrome/browser/search/most_visited_iframe_source.h" |
| 13 #include "chrome/browser/search/search.h" | 15 #include "chrome/browser/search/search.h" |
| 14 #include "chrome/browser/search/suggestions/suggestions_source.h" | 16 #include "chrome/browser/search/suggestions/suggestions_source.h" |
| 15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 17 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 16 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 17 #include "chrome/browser/themes/theme_properties.h" | 19 #include "chrome/browser/themes/theme_properties.h" |
| 18 #include "chrome/browser/themes/theme_service.h" | 20 #include "chrome/browser/themes/theme_service.h" |
| 19 #include "chrome/browser/themes/theme_service_factory.h" | 21 #include "chrome/browser/themes/theme_service_factory.h" |
| 20 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 22 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
| 21 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 23 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 22 #include "chrome/browser/ui/webui/fallback_icon_source.h" | 24 #include "chrome/browser/ui/webui/fallback_icon_source.h" |
| 23 #include "chrome/browser/ui/webui/favicon_source.h" | 25 #include "chrome/browser/ui/webui/favicon_source.h" |
| 24 #include "chrome/browser/ui/webui/large_icon_source.h" | 26 #include "chrome/browser/ui/webui/large_icon_source.h" |
| 25 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 27 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 26 #include "chrome/browser/ui/webui/theme_source.h" | 28 #include "chrome/browser/ui/webui/theme_source.h" |
| 27 #include "chrome/common/render_messages.h" | 29 #include "chrome/common/render_messages.h" |
| 30 #include "components/favicon/core/fallback_icon_service.h" | |
| 31 #include "components/favicon/core/favicon_service.h" | |
| 28 #include "components/history/core/browser/top_sites.h" | 32 #include "components/history/core/browser/top_sites.h" |
| 33 #include "components/keyed_service/core/service_access_type.h" | |
| 29 #include "components/search_engines/template_url_service.h" | 34 #include "components/search_engines/template_url_service.h" |
| 30 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 32 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
| 33 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
| 34 #include "content/public/browser/url_data_source.h" | 39 #include "content/public/browser/url_data_source.h" |
| 35 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
| 36 #include "third_party/skia/include/core/SkColor.h" | 41 #include "third_party/skia/include/core/SkColor.h" |
| 37 #include "ui/gfx/color_utils.h" | 42 #include "ui/gfx/color_utils.h" |
| 38 #include "ui/gfx/image/image_skia.h" | 43 #include "ui/gfx/image/image_skia.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 | 124 |
| 120 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled | 125 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled |
| 121 // on Android. | 126 // on Android. |
| 122 #if !defined(OS_ANDROID) | 127 #if !defined(OS_ANDROID) |
| 123 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 128 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
| 124 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 129 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
| 125 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 130 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
| 126 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 131 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
| 127 #endif // !defined(OS_ANDROID) | 132 #endif // !defined(OS_ANDROID) |
| 128 | 133 |
| 129 content::URLDataSource::Add(profile_, new LargeIconSource(profile)); | 134 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 130 content::URLDataSource::Add(profile_, new FallbackIconSource()); | 135 profile_, ServiceAccessType::EXPLICIT_ACCESS); |
| 136 FallbackIconService* fallback_icon_service = | |
| 137 FallbackIconServiceFactory::GetForProfile( | |
| 138 profile_, ServiceAccessType::EXPLICIT_ACCESS); | |
|
pkotwicz
2015/03/27 03:52:09
Nit: Remove new line
huangs
2015/03/27 17:33:07
Done.
| |
| 139 | |
| 140 content::URLDataSource::Add(profile_, | |
| 141 new LargeIconSource(favicon_service, fallback_icon_service)); | |
| 142 | |
|
pkotwicz
2015/03/27 03:52:09
Nit: Remove new line
huangs
2015/03/27 17:33:07
Done.
| |
| 143 content::URLDataSource::Add(profile_, | |
| 144 new FallbackIconSource(fallback_icon_service)); | |
| 145 | |
| 131 content::URLDataSource::Add( | 146 content::URLDataSource::Add( |
| 132 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 147 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
| 133 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 148 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
| 134 content::URLDataSource::Add( | 149 content::URLDataSource::Add( |
| 135 profile_, new suggestions::SuggestionsSource(profile_)); | 150 profile_, new suggestions::SuggestionsSource(profile_)); |
| 136 } | 151 } |
| 137 | 152 |
| 138 InstantService::~InstantService() { | 153 InstantService::~InstantService() { |
| 139 if (template_url_service_) | 154 if (template_url_service_) |
| 140 template_url_service_->RemoveObserver(this); | 155 template_url_service_->RemoveObserver(this); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 439 } | 454 } |
| 440 | 455 |
| 441 void InstantService::ResetInstantSearchPrerenderer() { | 456 void InstantService::ResetInstantSearchPrerenderer() { |
| 442 if (!chrome::ShouldPrefetchSearchResults()) | 457 if (!chrome::ShouldPrefetchSearchResults()) |
| 443 return; | 458 return; |
| 444 | 459 |
| 445 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 460 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
| 446 instant_prerenderer_.reset( | 461 instant_prerenderer_.reset( |
| 447 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); | 462 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); |
| 448 } | 463 } |
| OLD | NEW |