chrome_notifier_service_factory.cc revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
1// Copyright (c) 2013 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/notifications/sync_notifier/chrome_notifier_service_factory.h"
6
7#include "chrome/browser/browser_process.h"
8#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
9#include "chrome/browser/profiles/profile_dependency_manager.h"
10
11namespace notifier {
12
13// static
14ChromeNotifierService* ChromeNotifierServiceFactory::GetForProfile(
15    Profile* profile, Profile::ServiceAccessType sat) {
16  return static_cast<ChromeNotifierService*>(
17      GetInstance()->GetServiceForProfile(profile, true));
18}
19
20// static
21ChromeNotifierServiceFactory* ChromeNotifierServiceFactory::GetInstance() {
22  return Singleton<ChromeNotifierServiceFactory>::get();
23}
24
25ChromeNotifierServiceFactory::ChromeNotifierServiceFactory()
26    : ProfileKeyedServiceFactory(
27          "ChromeNotifierService", ProfileDependencyManager::GetInstance()) {}
28
29ChromeNotifierServiceFactory::~ChromeNotifierServiceFactory() {
30}
31
32ProfileKeyedService*
33ChromeNotifierServiceFactory::BuildServiceInstanceFor(
34    content::BrowserContext* profile) const {
35  NotificationUIManager* notification_manager =
36      g_browser_process->notification_ui_manager();
37  ChromeNotifierService* chrome_notifier_service =
38      new ChromeNotifierService(static_cast<Profile*>(profile),
39                                notification_manager);
40  return chrome_notifier_service;
41}
42
43}  // namespace notifier
44