Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / notifications / desktop_notification_service_factory.cc
blob4d8351ca8736dcfb05d48ce9ffff2be65d4fd62f
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/notifications/desktop_notification_service_factory.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/notifications/desktop_notification_service.h"
9 #include "chrome/browser/profiles/incognito_helpers.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "content/public/browser/browser_thread.h"
14 using content::BrowserThread;
16 // static
17 DesktopNotificationService* DesktopNotificationServiceFactory::GetForProfile(
18 Profile* profile) {
19 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
20 return static_cast<DesktopNotificationService*>(
21 GetInstance()->GetServiceForBrowserContext(profile, true));
24 // static
25 DesktopNotificationServiceFactory* DesktopNotificationServiceFactory::
26 GetInstance() {
27 return Singleton<DesktopNotificationServiceFactory>::get();
30 DesktopNotificationServiceFactory::DesktopNotificationServiceFactory()
31 : BrowserContextKeyedServiceFactory(
32 "DesktopNotificationService",
33 BrowserContextDependencyManager::GetInstance()) {
36 DesktopNotificationServiceFactory::~DesktopNotificationServiceFactory() {
39 KeyedService* DesktopNotificationServiceFactory::BuildServiceInstanceFor(
40 content::BrowserContext* context) const {
41 DesktopNotificationService* service =
42 new DesktopNotificationService(static_cast<Profile*>(context));
43 return service;
46 content::BrowserContext*
47 DesktopNotificationServiceFactory::GetBrowserContextToUse(
48 content::BrowserContext* context) const {
49 return chrome::GetBrowserContextOwnInstanceInIncognito(context);