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

Side by Side Diff: chrome/browser/ntp_snippets/ntp_snippets_service_factory.cc

Issue 1438043008: Creating the NTP snippet service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase fix: Don't trust git. Created 5 years, 1 month 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 2015 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/ntp_snippets/ntp_snippets_service_factory.h"
6
7 #include "base/logging.h"
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/ntp_snippets/ntp_snippets_service.h"
13 #include "content/public/browser/browser_context.h"
14
15 // static
16 NTPSnippetsServiceFactory* NTPSnippetsServiceFactory::GetInstance() {
17 return base::Singleton<NTPSnippetsServiceFactory>::get();
18 }
19
20 // static
21 ntp_snippets::NTPSnippetsService* NTPSnippetsServiceFactory::GetForProfile(
22 Profile* profile) {
23 DCHECK(!profile->IsOffTheRecord());
24 return static_cast<ntp_snippets::NTPSnippetsService*>(
25 GetInstance()->GetServiceForBrowserContext(profile, true));
26 }
27
28 NTPSnippetsServiceFactory::NTPSnippetsServiceFactory()
29 : BrowserContextKeyedServiceFactory(
30 "NTPSnippetsService",
31 BrowserContextDependencyManager::GetInstance()) {}
32
33 NTPSnippetsServiceFactory::~NTPSnippetsServiceFactory() {}
34
35 KeyedService* NTPSnippetsServiceFactory::BuildServiceInstanceFor(
36 content::BrowserContext* context) const {
37 return new ntp_snippets::NTPSnippetsService(
38 g_browser_process->GetApplicationLocale());
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698