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" | 8 #include "chrome/browser/favicon/fallback_icon_service_factory.h" |
| 9 #include "chrome/browser/favicon/large_icon_service_factory.h" | 9 #include "chrome/browser/favicon/large_icon_service_factory.h" |
| 10 #include "chrome/browser/history/top_sites_factory.h" | 10 #include "chrome/browser/history/top_sites_factory.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/search/instant_io_context.h" | 12 #include "chrome/browser/search/instant_io_context.h" |
| 13 #include "chrome/browser/search/instant_service_observer.h" | 13 #include "chrome/browser/search/instant_service_observer.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_source.h" | 16 #include "chrome/browser/search/suggestions/suggestions_source.h" |
| 17 #include "chrome/browser/search/thumbnail_source.h" | |
| 17 #include "chrome/browser/search_engines/template_url_service_factory.h" | 18 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 18 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 19 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
| 19 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 20 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
| 20 #include "chrome/browser/ui/search/instant_search_prerenderer.h" | 21 #include "chrome/browser/ui/search/instant_search_prerenderer.h" |
| 21 #include "chrome/browser/ui/webui/fallback_icon_source.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/large_icon_source.h" | 24 #include "chrome/browser/ui/webui/large_icon_source.h" |
| 24 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | |
| 25 #include "chrome/browser/ui/webui/theme_source.h" | 25 #include "chrome/browser/ui/webui/theme_source.h" |
| 26 #include "chrome/common/render_messages.h" | 26 #include "chrome/common/render_messages.h" |
| 27 #include "components/favicon/core/fallback_icon_service.h" | 27 #include "components/favicon/core/fallback_icon_service.h" |
| 28 #include "components/favicon/core/large_icon_service.h" | 28 #include "components/favicon/core/large_icon_service.h" |
| 29 #include "components/history/core/browser/top_sites.h" | 29 #include "components/history/core/browser/top_sites.h" |
| 30 #include "components/keyed_service/core/service_access_type.h" | 30 #include "components/keyed_service/core/service_access_type.h" |
| 31 #include "components/search_engines/template_url_service.h" | 31 #include "components/search_engines/template_url_service.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 void InstantService::RemoveObserver(InstantServiceObserver* observer) { | 160 void InstantService::RemoveObserver(InstantServiceObserver* observer) { |
| 161 observers_.RemoveObserver(observer); | 161 observers_.RemoveObserver(observer); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void InstantService::DeleteMostVisitedItem(const GURL& url) { | 164 void InstantService::DeleteMostVisitedItem(const GURL& url) { |
| 165 scoped_refptr<history::TopSites> top_sites = | 165 scoped_refptr<history::TopSites> top_sites = |
| 166 TopSitesFactory::GetForProfile(profile_); | 166 TopSitesFactory::GetForProfile(profile_); |
| 167 if (!top_sites) | 167 if (!top_sites) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 top_sites->AddBlacklistedURL(url); | 170 top_sites->AddBlacklistedURL(url); |
|
Dan Beam
2015/05/19 21:51:31
both pages interact with the blacklist in the same
| |
| 171 } | 171 } |
| 172 | 172 |
| 173 void InstantService::UndoMostVisitedDeletion(const GURL& url) { | 173 void InstantService::UndoMostVisitedDeletion(const GURL& url) { |
| 174 scoped_refptr<history::TopSites> top_sites = | 174 scoped_refptr<history::TopSites> top_sites = |
| 175 TopSitesFactory::GetForProfile(profile_); | 175 TopSitesFactory::GetForProfile(profile_); |
| 176 if (!top_sites) | 176 if (!top_sites) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 top_sites->RemoveBlacklistedURL(url); | 179 top_sites->RemoveBlacklistedURL(url); |
| 180 } | 180 } |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 } | 458 } |
| 459 | 459 |
| 460 void InstantService::ResetInstantSearchPrerenderer() { | 460 void InstantService::ResetInstantSearchPrerenderer() { |
| 461 if (!chrome::ShouldPrefetchSearchResults()) | 461 if (!chrome::ShouldPrefetchSearchResults()) |
| 462 return; | 462 return; |
| 463 | 463 |
| 464 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); | 464 GURL url(chrome::GetSearchResultPrefetchBaseURL(profile_)); |
| 465 instant_prerenderer_.reset( | 465 instant_prerenderer_.reset( |
| 466 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); | 466 url.is_valid() ? new InstantSearchPrerenderer(profile_, url) : NULL); |
| 467 } | 467 } |
| OLD | NEW |