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

Unified Diff: chrome/browser/notifier/chrome_notifier_service_factory.cc

Issue 11745024: Synced Notification Sync Change Processor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: SyncedNotifications - first round of CR comment fixes. Created 7 years, 11 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/notifier/chrome_notifier_service_factory.cc
diff --git a/chrome/browser/notifier/chrome_notifier_service_factory.cc b/chrome/browser/notifier/chrome_notifier_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e32ab91befcbc2713ccafd1101af5b67ba282f8d
--- /dev/null
+++ b/chrome/browser/notifier/chrome_notifier_service_factory.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2012 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/notifier/chrome_notifier_service_factory.h"
+
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/notifier/chrome_notifier_service.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile_dependency_manager.h"
+
+// static
+ChromeNotifierService* ChromeNotifierServiceFactory::GetForProfile(
+ Profile* profile, Profile::ServiceAccessType sat) {
+ return static_cast<ChromeNotifierService*>(
+ GetInstance()->GetServiceForProfile(profile, true));
+}
+
+// static
+ChromeNotifierService*
+ChromeNotifierServiceFactory::GetForProfileIfExists(
+ Profile* profile, Profile::ServiceAccessType sat) {
+ return static_cast<ChromeNotifierService*>(
+ GetInstance()->GetServiceForProfile(profile, false));
+}
+
+// static
+ChromeNotifierService*
+ChromeNotifierServiceFactory::GetForProfileWithoutCreating(Profile* profile) {
+ return static_cast<ChromeNotifierService*>(
+ GetInstance()->GetServiceForProfile(profile, false));
+}
+
+// static
+ChromeNotifierServiceFactory* ChromeNotifierServiceFactory::GetInstance() {
+ return Singleton<ChromeNotifierServiceFactory>::get();
+}
+
+ChromeNotifierServiceFactory::ChromeNotifierServiceFactory()
+ : ProfileKeyedServiceFactory(
+ "ChromeNotifierService", ProfileDependencyManager::GetInstance()) {}
+
+ChromeNotifierServiceFactory::~ChromeNotifierServiceFactory() {
+}
+
+ProfileKeyedService*
+ChromeNotifierServiceFactory::BuildServiceInstanceFor(Profile* profile) const {
+ // TODO: This assumes the notification_ui_manager remains valid throughout the
dcheng 2013/01/18 21:56:13 TODO's should have an associated name.
Pete Williamson 2013/01/23 01:45:55 Instead, I just did the research and removed the T
+ // session. Is that a good assumption?
+ NotificationUIManager* notification_manager =
+ g_browser_process->notification_ui_manager();
+ ChromeNotifierService* chrome_notifier_service =
+ new ChromeNotifierService(profile, notification_manager);
+ return chrome_notifier_service;
+}
+
+bool ChromeNotifierServiceFactory::ServiceRedirectedInIncognito() const {
+ return true;
dcheng 2013/01/18 21:56:13 It might be helpful to comment why we can't just u
Pete Williamson 2013/01/23 01:45:55 Started an email thread to find the right setting
+}
+
+bool ChromeNotifierServiceFactory::ServiceIsNULLWhileTesting() const {
+ return true;
+}
+
+bool ChromeNotifierServiceFactory::ServiceIsCreatedWithProfile() const {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698