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

Side by Side Diff: chrome/browser/notifications/extensions/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: 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/extensions/extension_welcome_notification _factory.h"
6
7 #include "chrome/browser/notifications/extensions/extension_welcome_notification .h"
8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "content/public/browser/browser_thread.h"
12
13 // static
14 ExtensionWelcomeNotification*
15 ExtensionWelcomeNotificationFactory::GetForBrowserContext(
16 content::BrowserContext* context) {
17 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
18 return static_cast<ExtensionWelcomeNotification*>(
19 GetInstance()->GetServiceForBrowserContext(context, true));
20 }
21
22 // static
23 ExtensionWelcomeNotificationFactory*
24 ExtensionWelcomeNotificationFactory::GetInstance() {
25 return Singleton<ExtensionWelcomeNotificationFactory>::get();
26 }
27
28 ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory()
29 : BrowserContextKeyedServiceFactory(
30 "ExtensionWelcomeNotification",
31 BrowserContextDependencyManager::GetInstance()) {}
Jun Mukai 2014/09/18 17:53:48 DependsOn(DesktopNotificationServiceFactory::GetIn
Peter Beverloo 2014/09/19 13:01:22 Done.
32
33 ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {}
34
35 KeyedService* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor(
36 content::BrowserContext* context) const {
37 scoped_ptr<ExtensionWelcomeNotification> welcome_notification =
38 ExtensionWelcomeNotification::Create(static_cast<Profile*>(context));
Jun Mukai 2014/09/18 17:53:48 It's better to cleanup the initialization -- chang
Peter Beverloo 2014/09/19 13:01:22 I'm inclined to disagree. Returning a scoped_ptr i
39
40 return welcome_notification.release();
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