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

Unified Diff: chrome/browser/notifications/desktop_notification_service_factory.cc

Issue 6803012: Profile shouldn't own DesktopNotificationService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dependency manager unit test Created 9 years, 8 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/desktop_notification_service_factory.cc
diff --git a/chrome/browser/notifications/desktop_notification_service_factory.cc b/chrome/browser/notifications/desktop_notification_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..828ef57ddad5c8b64a321f1c1b1207ecc9265b5f
--- /dev/null
+++ b/chrome/browser/notifications/desktop_notification_service_factory.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 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/desktop_notification_service_factory.h"
+
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/notifications/desktop_notification_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "content/browser/browser_thread.h"
+
+// static
+DesktopNotificationService* DesktopNotificationServiceFactory::GetForProfile(
+ Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return static_cast<DesktopNotificationService*>(
+ GetInstance()->GetServiceForProfile(profile));
+}
+
+// static
+DesktopNotificationServiceFactory* DesktopNotificationServiceFactory::
+ GetInstance() {
+ return Singleton<DesktopNotificationServiceFactory>::get();
+}
+
+DesktopNotificationServiceFactory::DesktopNotificationServiceFactory()
+ : ProfileKeyedServiceFactory(ProfileDependencyManager::GetInstance())
+{}
Avi (use Gerrit) 2011/04/12 13:57:15 Opening brace on previous line.
Torne 2011/04/12 15:22:12 Done.
+
+DesktopNotificationServiceFactory::~DesktopNotificationServiceFactory() {}
Avi (use Gerrit) 2011/04/12 13:57:15 Closing brace on following line.
Torne 2011/04/12 15:22:12 Done.
+
+ProfileKeyedService* DesktopNotificationServiceFactory::BuildServiceInstanceFor(
+ Profile* profile) const {
+ DesktopNotificationService* service = new DesktopNotificationService(profile,
+ g_browser_process->notification_ui_manager());
+
+ return service;
+}
+
+bool DesktopNotificationServiceFactory::ServiceHasOwnInstanceInIncognito() {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698