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) | |
115 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 112 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
116 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 113 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
117 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 114 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
118 #endif // !defined(OS_ANDROID) | |
119 | |
120 content::URLDataSource::Add( | 115 content::URLDataSource::Add( |
121 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 116 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
122 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 117 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
123 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 118 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
124 if (suggestions::SuggestionsService::IsEnabled()) { | 119 if (suggestions::SuggestionsService::IsEnabled()) { |
125 content::URLDataSource::Add( | 120 content::URLDataSource::Add( |
126 profile_, new suggestions::SuggestionsSource(profile_)); | 121 profile_, new suggestions::SuggestionsSource(profile_)); |
127 } | 122 } |
128 | 123 |
129 profile_pref_registrar_.Init(profile_->GetPrefs()); | 124 profile_pref_registrar_.Init(profile_->GetPrefs()); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 void InstantService::ResetInstantSearchPrerenderer() { | 447 void InstantService::ResetInstantSearchPrerenderer() { |
453 if (!chrome::ShouldPrefetchSearchResults()) | 448 if (!chrome::ShouldPrefetchSearchResults()) |
454 return; | 449 return; |
455 | 450 |
456 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 451 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
457 if (url.is_valid()) | 452 if (url.is_valid()) |
458 instant_prerenderer_.reset(new InstantSearchPrerenderer(profile_, url)); | 453 instant_prerenderer_.reset(new InstantSearchPrerenderer(profile_, url)); |
459 else | 454 else |
460 instant_prerenderer_.reset(); | 455 instant_prerenderer_.reset(); |
461 } | 456 } |
OLD | NEW |