| 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" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 scoped_refptr<history::TopSites> TopSitesFactory::GetForProfile( | 74 scoped_refptr<history::TopSites> TopSitesFactory::GetForProfile( |
| 75 Profile* profile) { | 75 Profile* profile) { |
| 76 return static_cast<history::TopSites*>( | 76 return static_cast<history::TopSites*>( |
| 77 GetInstance()->GetServiceForBrowserContext(profile, true).get()); | 77 GetInstance()->GetServiceForBrowserContext(profile, true).get()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // static | 80 // static |
| 81 TopSitesFactory* TopSitesFactory::GetInstance() { | 81 TopSitesFactory* TopSitesFactory::GetInstance() { |
| 82 return Singleton<TopSitesFactory>::get(); | 82 return base::Singleton<TopSitesFactory>::get(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // static | 85 // static |
| 86 scoped_refptr<history::TopSites> TopSitesFactory::BuildTopSites( | 86 scoped_refptr<history::TopSites> TopSitesFactory::BuildTopSites( |
| 87 content::BrowserContext* context, | 87 content::BrowserContext* context, |
| 88 const std::vector<history::PrepopulatedPage>& prepopulated_page_list) { | 88 const std::vector<history::PrepopulatedPage>& prepopulated_page_list) { |
| 89 Profile* profile = Profile::FromBrowserContext(context); | 89 Profile* profile = Profile::FromBrowserContext(context); |
| 90 scoped_refptr<history::TopSitesImpl> top_sites(new history::TopSitesImpl( | 90 scoped_refptr<history::TopSitesImpl> top_sites(new history::TopSitesImpl( |
| 91 profile->GetPrefs(), HistoryServiceFactory::GetForProfile( | 91 profile->GetPrefs(), HistoryServiceFactory::GetForProfile( |
| 92 profile, ServiceAccessType::EXPLICIT_ACCESS), | 92 profile, ServiceAccessType::EXPLICIT_ACCESS), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 115 } | 115 } |
| 116 | 116 |
| 117 void TopSitesFactory::RegisterProfilePrefs( | 117 void TopSitesFactory::RegisterProfilePrefs( |
| 118 user_prefs::PrefRegistrySyncable* registry) { | 118 user_prefs::PrefRegistrySyncable* registry) { |
| 119 history::TopSitesImpl::RegisterPrefs(registry); | 119 history::TopSitesImpl::RegisterPrefs(registry); |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool TopSitesFactory::ServiceIsNULLWhileTesting() const { | 122 bool TopSitesFactory::ServiceIsNULLWhileTesting() const { |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| OLD | NEW |