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

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 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.
sdefresne 2015/01/08 10:41:01 nit: you'll only land this is 2015, so please use
Jitu( very slow this week) 2015/01/12 11:30:07 Done.
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;
sdefresne 2015/01/08 10:41:01 nit: we prefer not to use "using namespace" unless
Bernhard Bauer 2015/01/08 10:45:14 Good catch! The Google C++ style guide is actually
Jitu( very slow this week) 2015/01/12 11:30:07 Done.
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 scoped_refptr<RefcountedKeyedService> TopSitesFactory::BuildServiceInstanceFor(
34 content::BrowserContext* profile) const {
sdefresne 2015/01/08 10:41:01 nit: s/profile/context/
Jitu( very slow this week) 2015/01/12 11:30:07 Done.
35 TopSitesImpl* top_sites = new TopSitesImpl(static_cast<Profile*>(profile));
36 top_sites->Init(profile->GetPath().Append(chrome::kTopSitesFilename));
37 return make_scoped_refptr<history::TopSites>(top_sites);
Bernhard Bauer 2015/01/08 10:22:05 Does a simple make_scoped_refptr() work? If it doe
Jitu( very slow this week) 2015/01/12 11:30:07 I think return make_scoped_refptr(top_sites) work
Bernhard Bauer 2015/01/12 14:32:23 That would be a possible alternative, but what you
38 }
39
40 TopSitesFactory::TopSitesFactory()
41 : RefcountedBrowserContextKeyedServiceFactory(
42 "TopSitesService",
sdefresne 2015/01/08 10:41:01 nit: the value passed there is usually the name of
Jitu( very slow this week) 2015/01/12 11:30:07 Done.
Jitu( very slow this week) 2015/01/12 11:30:07 Done.
43 BrowserContextDependencyManager::GetInstance()) {
44 }
45
46 TopSitesFactory::~TopSitesFactory() {
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698