Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / thumbnails / thumbnail_service_factory.cc
blob1daa9bc163293bf8d1c7612d2b9a4063f4005a9c
1 // Copyright (c) 2012 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.
5 #include "chrome/browser/thumbnails/thumbnail_service_factory.h"
7 #include "base/logging.h"
8 #include "chrome/browser/history/top_sites_factory.h"
9 #include "chrome/browser/thumbnails/thumbnail_service.h"
10 #include "chrome/browser/thumbnails/thumbnail_service_impl.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 using thumbnails::ThumbnailService;
14 using thumbnails::ThumbnailServiceImpl;
16 ThumbnailServiceFactory::ThumbnailServiceFactory()
17 : RefcountedBrowserContextKeyedServiceFactory(
18 "ThumbnailService",
19 BrowserContextDependencyManager::GetInstance()) {
20 DependsOn(TopSitesFactory::GetInstance());
23 ThumbnailServiceFactory::~ThumbnailServiceFactory() {
26 // static
27 scoped_refptr<ThumbnailService> ThumbnailServiceFactory::GetForProfile(
28 Profile* profile) {
29 return static_cast<ThumbnailService*>(
30 GetInstance()->GetServiceForBrowserContext(profile, true).get());
33 // static
34 ThumbnailServiceFactory* ThumbnailServiceFactory::GetInstance() {
35 return Singleton<ThumbnailServiceFactory>::get();
38 scoped_refptr<RefcountedKeyedService>
39 ThumbnailServiceFactory::BuildServiceInstanceFor(
40 content::BrowserContext* profile) const {
41 return scoped_refptr<RefcountedKeyedService>(
42 new ThumbnailServiceImpl(static_cast<Profile*>(profile)));