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/history/most_visited_tiles_experiment.h" | 8 #include "chrome/browser/history/most_visited_tiles_experiment.h" |
| 9 #include "chrome/browser/history/top_sites.h" | 9 #include "chrome/browser/history/top_sites.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search/instant_io_context.h" | 11 #include "chrome/browser/search/instant_io_context.h" |
| 12 #include "chrome/browser/search/instant_service_observer.h" | 12 #include "chrome/browser/search/instant_service_observer.h" |
| 13 #include "chrome/browser/search/local_ntp_source.h" | 13 #include "chrome/browser/search/local_ntp_source.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_service.h" | |
| 16 #include "chrome/browser/search/suggestions/suggestions_source.h" | 17 #include "chrome/browser/search/suggestions/suggestions_source.h" |
| 17 #include "chrome/browser/search_engines/template_url_service.h" | 18 #include "chrome/browser/search_engines/template_url_service.h" |
| 18 #include "chrome/browser/search_engines/template_url_service_factory.h" | 19 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 19 #include "chrome/browser/themes/theme_properties.h" | 20 #include "chrome/browser/themes/theme_properties.h" |
| 20 #include "chrome/browser/themes/theme_service.h" | 21 #include "chrome/browser/themes/theme_service.h" |
| 21 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
| 22 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 23 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
| 23 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 24 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 24 #include "chrome/browser/ui/webui/favicon_source.h" | 25 #include "chrome/browser/ui/webui/favicon_source.h" |
| 25 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 26 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 112 #if !defined(OS_ANDROID) | 113 #if !defined(OS_ANDROID) |
| 113 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); | 114 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, false)); |
| 114 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); | 115 content::URLDataSource::Add(profile_, new ThumbnailSource(profile_, true)); |
| 115 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); | 116 content::URLDataSource::Add(profile_, new ThumbnailListSource(profile_)); |
| 116 #endif // !defined(OS_ANDROID) | 117 #endif // !defined(OS_ANDROID) |
| 117 | 118 |
| 118 content::URLDataSource::Add( | 119 content::URLDataSource::Add( |
| 119 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); | 120 profile_, new FaviconSource(profile_, FaviconSource::FAVICON)); |
| 120 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); | 121 content::URLDataSource::Add(profile_, new LocalNtpSource(profile_)); |
| 121 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); | 122 content::URLDataSource::Add(profile_, new MostVisitedIframeSource()); |
| 122 <<<<<<< HEAD | |
|
Peter Kasting
2014/05/07 23:38:29
Hmm, looks like maybe your checkout wasn't rebased
| |
| 123 content::URLDataSource::Add( | |
| 124 profile_, new suggestions::SuggestionsSource(profile_)); | |
| 125 | |
| 126 profile_pref_registrar_.Init(profile_->GetPrefs()); | |
| 127 profile_pref_registrar_.Add( | |
| 128 prefs::kDefaultSearchProviderID, | |
| 129 base::Bind(&InstantService::OnDefaultSearchProviderChanged, | |
| 130 base::Unretained(this))); | |
| 131 | |
| 132 registrar_.Add(this, chrome::NOTIFICATION_GOOGLE_URL_UPDATED, | |
| 133 content::Source<Profile>(profile_->GetOriginalProfile())); | |
| 134 ======= | |
| 135 if (suggestions::SuggestionsService::IsEnabled()) { | 123 if (suggestions::SuggestionsService::IsEnabled()) { |
| 136 content::URLDataSource::Add( | 124 content::URLDataSource::Add( |
| 137 profile_, new suggestions::SuggestionsSource(profile_)); | 125 profile_, new suggestions::SuggestionsSource(profile_)); |
| 138 } | 126 } |
| 139 >>>>>>> dse_turn_it_on_base | |
| 140 } | 127 } |
| 141 | 128 |
| 142 InstantService::~InstantService() { | 129 InstantService::~InstantService() { |
| 143 } | 130 } |
| 144 | 131 |
| 145 void InstantService::AddInstantProcess(int process_id) { | 132 void InstantService::AddInstantProcess(int process_id) { |
| 146 process_ids_.insert(process_id); | 133 process_ids_.insert(process_id); |
| 147 | 134 |
| 148 if (instant_io_context_.get()) { | 135 if (instant_io_context_.get()) { |
| 149 content::BrowserThread::PostTask( | 136 content::BrowserThread::PostTask( |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 if (!chrome::ShouldPrefetchSearchResults()) | 415 if (!chrome::ShouldPrefetchSearchResults()) |
| 429 return; | 416 return; |
| 430 | 417 |
| 431 if (current_search_result_prefetch_base_url_.is_valid()) { | 418 if (current_search_result_prefetch_base_url_.is_valid()) { |
| 432 instant_prerenderer_.reset(new InstantSearchPrerenderer( | 419 instant_prerenderer_.reset(new InstantSearchPrerenderer( |
| 433 profile_, current_search_result_prefetch_base_url_)); | 420 profile_, current_search_result_prefetch_base_url_)); |
| 434 } else { | 421 } else { |
| 435 instant_prerenderer_.reset(); | 422 instant_prerenderer_.reset(); |
| 436 } | 423 } |
| 437 } | 424 } |
| OLD | NEW |