Chromium Code Reviews| Index: chrome/browser/history/top_sites_service_factory.cc |
| diff --git a/chrome/browser/history/top_sites_service_factory.cc b/chrome/browser/history/top_sites_service_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2ce23246ccab2dc4ad0e0f54ea6a56612545dadf |
| --- /dev/null |
| +++ b/chrome/browser/history/top_sites_service_factory.cc |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/history/top_sites_service_factory.h" |
| + |
| +#include "base/logging.h" |
| +#include "chrome/browser/history/top_sites_service.h" |
| +#include "chrome/common/chrome_constants.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| + |
| +using namespace history; |
| + |
| +// static |
| +history::TopSitesService* TopSitesServiceFactory::GetForProfile( |
| + Profile* profile) { |
| + return static_cast<history::TopSitesService*>( |
| + GetInstance()->GetServiceForBrowserContext(profile, true)); |
| +} |
| + |
| +// static |
| +TopSitesServiceFactory* TopSitesServiceFactory::GetInstance() { |
| + return Singleton<TopSitesServiceFactory>::get(); |
| +} |
| + |
| +TopSitesServiceFactory::TopSitesServiceFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "TopsitesService", |
|
sdefresne
2014/12/19 15:11:41
s/TopsitesService/TopSitesService/
Jitu( very slow this week)
2014/12/26 14:04:27
Done.
|
| + BrowserContextDependencyManager::GetInstance()) { |
| +} |
| + |
| +TopSitesServiceFactory::~TopSitesServiceFactory() { |
| +} |
| + |
| +KeyedService* TopSitesServiceFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* profile) const { |
| + TopSitesService* provider = NULL; |
|
sdefresne
2014/12/19 15:11:41
s/NULL/nullptr/
Jitu( very slow this week)
2014/12/26 14:04:28
Done.
|
| + provider = new TopSitesService(static_cast<Profile*>(profile)); |
| + provider->Init(profile->GetPath().Append(chrome::kTopSitesFilename)); |
| + return provider; |
| +} |