| 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/history/top_sites.h" | 8 #include "chrome/browser/history/top_sites.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/search/instant_io_context.h" | 10 #include "chrome/browser/search/instant_io_context.h" |
| 11 #include "chrome/browser/search/instant_service_observer.h" | 11 #include "chrome/browser/search/instant_service_observer.h" |
| 12 #include "chrome/browser/search/most_visited_iframe_source.h" | 12 #include "chrome/browser/search/most_visited_iframe_source.h" |
| 13 #include "chrome/browser/search/search.h" | 13 #include "chrome/browser/search/search.h" |
| 14 #include "chrome/browser/search/suggestions/suggestions_source.h" | 14 #include "chrome/browser/search/suggestions/suggestions_source.h" |
| 15 #include "chrome/browser/search_engines/template_url_service_factory.h" | 15 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 16 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 16 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 17 #include "chrome/browser/themes/theme_properties.h" | 17 #include "chrome/browser/themes/theme_properties.h" |
| 18 #include "chrome/browser/themes/theme_service.h" | 18 #include "chrome/browser/themes/theme_service.h" |
| 19 #include "chrome/browser/themes/theme_service_factory.h" | 19 #include "chrome/browser/themes/theme_service_factory.h" |
| 20 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 20 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
| 21 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 21 #include "chrome/browser/ui/search/instant_search_prerenderer.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/ntp/thumbnail_source.h" | 24 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| 24 #include "chrome/browser/ui/webui/theme_source.h" | 25 #include "chrome/browser/ui/webui/theme_source.h" |
| 25 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 26 #include "components/search_engines/template_url_service.h" | 27 #include "components/search_engines/template_url_service.h" |
| 27 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 28 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/notification_types.h" | 30 #include "content/public/browser/notification_types.h" |
| 30 #include "content/public/browser/render_process_host.h" | 31 #include "content/public/browser/render_process_host.h" |
| 31 #include "content/public/browser/url_data_source.h" | 32 #include "content/public/browser/url_data_source.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled | 120 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled |
| 120 // on Android. | 121 // on Android. |
| 121 #if !defined(OS_ANDROID) | 122 #if !defined(OS_ANDROID) |
| 122 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 123 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
| 123 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 124 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
| 124 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 125 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
| 125 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 126 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
| 126 #endif // !defined(OS_ANDROID) | 127 #endif // !defined(OS_ANDROID) |
| 127 | 128 |
| 129 content::URLDataSource::Add(profile_, new FallbackIconSource()); |
| 128 content::URLDataSource::Add( | 130 content::URLDataSource::Add( |
| 129 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 131 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
| 130 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 132 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
| 131 content::URLDataSource::Add( | 133 content::URLDataSource::Add( |
| 132 profile_, new suggestions::SuggestionsSource(profile_)); | 134 profile_, new suggestions::SuggestionsSource(profile_)); |
| 133 } | 135 } |
| 134 | 136 |
| 135 InstantService::~InstantService() { | 137 InstantService::~InstantService() { |
| 136 if (template_url_service_) | 138 if (template_url_service_) |
| 137 template_url_service_->RemoveObserver(this); | 139 template_url_service_->RemoveObserver(this); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 426 } |
| 425 | 427 |
| 426 void InstantService::ResetInstantSearchPrerenderer() { | 428 void InstantService::ResetInstantSearchPrerenderer() { |
| 427 if (!chrome::ShouldPrefetchSearchResults()) | 429 if (!chrome::ShouldPrefetchSearchResults()) |
| 428 return; | 430 return; |
| 429 | 431 |
| 430 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 432 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
| 431 instant_prerenderer_.reset( | 433 instant_prerenderer_.reset( |
| 432 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); | 434 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); |
| 433 } | 435 } |
| OLD | NEW |