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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/extension_welcome_notification_factory.cc
diff --git a/chrome/browser/notifications/extension_welcome_notification_factory.cc b/chrome/browser/notifications/extension_welcome_notification_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e7c9655ff94db5b5772b139a0a9c85c29c4abfcc
--- /dev/null
+++ b/chrome/browser/notifications/extension_welcome_notification_factory.cc
@@ -0,0 +1,47 @@
+// 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/notifications/extension_welcome_notification_factory.h"
+
+#include "chrome/browser/notifications/desktop_notification_service_factory.h"
+#include "chrome/browser/notifications/extension_welcome_notification.h"
+#include "chrome/browser/profiles/incognito_helpers.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_thread.h"
+
+// static
+ExtensionWelcomeNotification*
+ExtensionWelcomeNotificationFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ return static_cast<ExtensionWelcomeNotification*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+ExtensionWelcomeNotificationFactory*
+ExtensionWelcomeNotificationFactory::GetInstance() {
+ return Singleton<ExtensionWelcomeNotificationFactory>::get();
+}
+
+ExtensionWelcomeNotificationFactory::ExtensionWelcomeNotificationFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ExtensionWelcomeNotification",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(DesktopNotificationServiceFactory::GetInstance());
+}
+
+ExtensionWelcomeNotificationFactory::~ExtensionWelcomeNotificationFactory() {}
+
+KeyedService* ExtensionWelcomeNotificationFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return ExtensionWelcomeNotification::Create(static_cast<Profile*>(context));
+}
+
+content::BrowserContext*
+ExtensionWelcomeNotificationFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return chrome::GetBrowserContextOwnInstanceInIncognito(context);
+}

Powered by Google App Engine
This is Rietveld 408576698