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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Set up the data sources that Instant uses on the NTP. | 102 // Set up the data sources that Instant uses on the NTP. |
103 #if defined(ENABLE_THEMES) | 103 #if defined(ENABLE_THEMES) |
104 // Listen for theme installation. | 104 // Listen for theme installation. |
105 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 105 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
106 content::Source<ThemeService>( | 106 content::Source<ThemeService>( |
107 ThemeServiceFactory::GetForProfile(profile_))); | 107 ThemeServiceFactory::GetForProfile(profile_))); |
108 | 108 |
109 content::URLDataSource::Add(profile_, new ThemeSource(profile_)); | 109 content::URLDataSource::Add(profile_, new ThemeSource(profile_)); |
110 #endif // defined(ENABLE_THEMES) | 110 #endif // defined(ENABLE_THEMES) |
111 | 111 |
| 112 // TODO(aurimas) remove this #if once instant_service.cc is no longer compiled |
| 113 // on Android. |
| 114 #if !defined(OS_ANDROID) |
112 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 115 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
113 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 116 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
114 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 117 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
| 118 #endif // !defined(OS_ANDROID) |
| 119 |
115 content::URLDataSource::Add( | 120 content::URLDataSource::Add( |
116 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 121 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
117 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 122 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
118 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 123 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
119 if (suggestions::SuggestionsService::IsEnabled()) { | 124 if (suggestions::SuggestionsService::IsEnabled()) { |
120 content::URLDataSource::Add( | 125 content::URLDataSource::Add( |
121 profile_, new suggestions::SuggestionsSource(profile_)); | 126 profile_, new suggestions::SuggestionsSource(profile_)); |
122 } | 127 } |
123 | 128 |
124 profile_pref_registrar_.Init(profile_->GetPrefs()); | 129 profile_pref_registrar_.Init(profile_->GetPrefs()); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 void InstantService::ResetInstantSearchPrerenderer() { | 452 void InstantService::ResetInstantSearchPrerenderer() { |
448 if (!chrome::ShouldPrefetchSearchResults()) | 453 if (!chrome::ShouldPrefetchSearchResults()) |
449 return; | 454 return; |
450 | 455 |
451 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 456 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
452 if (url.is_valid()) | 457 if (url.is_valid()) |
453 instant_prerenderer_.reset(new InstantSearchPrerenderer(profile_, url)); | 458 instant_prerenderer_.reset(new InstantSearchPrerenderer(profile_, url)); |
454 else | 459 else |
455 instant_prerenderer_.reset(); | 460 instant_prerenderer_.reset(); |
456 } | 461 } |
OLD | NEW |