OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/history/top_sites_factory.h" | 5 #include "chrome/browser/history/top_sites_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
11 #include "chrome/browser/history/history_utils.h" | 11 #include "chrome/browser/history/history_utils.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "chrome/grit/locale_settings.h" | 16 #include "chrome/grit/locale_settings.h" |
17 #include "components/history/core/browser/history_constants.h" | 17 #include "components/history/core/browser/history_constants.h" |
18 #include "components/history/core/browser/top_sites_impl.h" | 18 #include "components/history/core/browser/top_sites_impl.h" |
19 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 19 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
20 #include "components/pref_registry/pref_registry_syncable.h" | |
21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
22 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
24 #include "url/gurl.h" | 23 #include "url/gurl.h" |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 struct RawPrepopulatedPage { | 27 struct RawPrepopulatedPage { |
29 int url_id; // The resource for the page URL. | 28 int url_id; // The resource for the page URL. |
30 int title_id; // The resource for the page title. | 29 int title_id; // The resource for the page title. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 TopSitesFactory::~TopSitesFactory() { | 108 TopSitesFactory::~TopSitesFactory() { |
110 } | 109 } |
111 | 110 |
112 scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor( | 111 scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor( |
113 content::BrowserContext* context) const { | 112 content::BrowserContext* context) const { |
114 history::PrepopulatedPageList prepopulated_pages; | 113 history::PrepopulatedPageList prepopulated_pages; |
115 InitializePrepopulatedPageList(&prepopulated_pages); | 114 InitializePrepopulatedPageList(&prepopulated_pages); |
116 return BuildTopSites(context, prepopulated_pages); | 115 return BuildTopSites(context, prepopulated_pages); |
117 } | 116 } |
118 | 117 |
119 void TopSitesFactory::RegisterProfilePrefs( | |
120 user_prefs::PrefRegistrySyncable* registry) { | |
121 registry->RegisterDictionaryPref(prefs::kNtpMostVisitedURLsBlacklist); | |
122 } | |
123 | |
124 bool TopSitesFactory::ServiceIsNULLWhileTesting() const { | 118 bool TopSitesFactory::ServiceIsNULLWhileTesting() const { |
125 return true; | 119 return true; |
126 } | 120 } |
OLD | NEW |