summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_factory.cc
blob: 9f1a7f686fff75afef8148c696f585123b47519d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// 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/bitmap_fetcher/bitmap_fetcher_service_factory.h"

#include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h"
#include "chrome/browser/profiles/profile.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"

/// Factory
BitmapFetcherService* BitmapFetcherServiceFactory::GetForBrowserContext(
    content::BrowserContext* profile) {
  return static_cast<BitmapFetcherService*>(
      GetInstance()->GetServiceForBrowserContext(profile, true));
}

// static
BitmapFetcherServiceFactory* BitmapFetcherServiceFactory::GetInstance() {
  return Singleton<BitmapFetcherServiceFactory>::get();
}

BitmapFetcherServiceFactory::BitmapFetcherServiceFactory()
    : BrowserContextKeyedServiceFactory(
          "BitmapFetcherService",
          BrowserContextDependencyManager::GetInstance()) {
}

BitmapFetcherServiceFactory::~BitmapFetcherServiceFactory() {
}

KeyedService* BitmapFetcherServiceFactory::BuildServiceInstanceFor(
    content::BrowserContext* context) const {
  Profile* profile = static_cast<Profile*>(context);
  DCHECK(!profile->IsOffTheRecord());
  return new BitmapFetcherService(profile);
}