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

Side by Side Diff: chrome/browser/notifications/extension_welcome_notification_factory.cc

Issue 580093003: Factor Google Now welcome notifications out of DesktopNotificationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 months 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 2014 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/extension_welcome_notification_factory.h"
6
7 #include "chrome/browser/notifications/desktop_notification_service_factory.h"
8 #include "chrome/browser/notifications/extension_welcome_notification.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"
13
14 // static
15 ExtensionWelcomeNotification*
16 ExtensionWelcomeNotificationFactory::GetForBrowserContext(
17 content::BrowserContext* context) {
18 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
19 return static_cast<ExtensionWelcomeNotification*>(
20 GetInstance()->GetServiceForBrowserContext(context, true));
21 }
22
23 // static
24 ExtensionWelcomeNotificationFactory*
25 ExtensionWelcomeNotificationFactory::GetInstance() {
26 return Singleton<ExtensionWelcomeNotificationFactory>::get();
27 }
28
29 ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory()
30 : BrowserContextKeyedServiceFactory(
31 "ExtensionWelcomeNotification",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(DesktopNotificationServiceFactory::GetInstance());
34 }
35
36 ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {}
37
38 KeyedService* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor(
39 content::BrowserContext* context) const {
40 return ExtensionWelcomeNotification::Create(static_cast<Profile*>(context));
41 }
42
43 content::BrowserContext*
44 ExtensionWelcomeNotificationFactory::GetBrowserContextToUse(
45 content::BrowserContext* context) const {
46 return chrome::GetBrowserContextOwnInstanceInIncognito(context);
47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698