Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: chrome/browser/history/top_sites_factory.cc

Issue 815983002: Topsites become keyedService based. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix the review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/history/top_sites_factory.h"
6
7 #include "chrome/browser/history/top_sites_impl.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/common/chrome_constants.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11
12 using namespace history;
13
14 // static
15 scoped_refptr<history::TopSites> TopSitesFactory::GetForProfile(
16 Profile* profile) {
17 return static_cast<history::TopSites*>(
18 GetInstance()->GetServiceForBrowserContext(profile, true).get());
19 }
20
21 // static
22 scoped_refptr<history::TopSites> TopSitesFactory::GetForProfileIfExists(
23 Profile* profile) {
24 return static_cast<history::TopSites*>(
25 GetInstance()->GetServiceForBrowserContext(profile, false).get());
26 }
27
28 // static
29 TopSitesFactory* TopSitesFactory::GetInstance() {
30 return Singleton<TopSitesFactory>::get();
31 }
32
33 TopSitesFactory::TopSitesFactory()
34 : RefcountedBrowserContextKeyedServiceFactory(
35 "TopSitesService",
36 BrowserContextDependencyManager::GetInstance()) {
37 }
38
39 TopSitesFactory::~TopSitesFactory() {
40 }
41
42 scoped_refptr<RefcountedKeyedService>
Bernhard Bauer 2015/01/06 11:10:30 Can you move this above the constructor and destru
Jitu( very slow this week) 2015/01/08 09:38:25 Done.
43 TopSitesFactory::BuildServiceInstanceFor(
44 content::BrowserContext* profile) const {
45 TopSitesImpl* top_sites = new TopSitesImpl(static_cast<Profile*>(profile));
46 top_sites->Init(profile->GetPath().Append(chrome::kTopSitesFilename));
47 return scoped_refptr<history::TopSites>(top_sites);
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698