Index: chrome/browser/notifications/extensions/extension_welcome_notification.h |
diff --git a/chrome/browser/notifications/extension_welcome_notification.h b/chrome/browser/notifications/extensions/extension_welcome_notification.h |
similarity index 81% |
rename from chrome/browser/notifications/extension_welcome_notification.h |
rename to chrome/browser/notifications/extensions/extension_welcome_notification.h |
index 65bdea032b04c0da634425f3644cc9f585c6525c..bfa7edc6e856fc8d7bf587f953cb7e446f6ec999 100644 |
--- a/chrome/browser/notifications/extension_welcome_notification.h |
+++ b/chrome/browser/notifications/extensions/extension_welcome_notification.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |
-#define CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |
+#ifndef CHROME_BROWSER_NOTIFICATIONS_EXTENSIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |
+#define CHROME_BROWSER_NOTIFICATIONS_EXTENSIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |
#include <string> |
@@ -11,6 +11,7 @@ |
#include "base/prefs/pref_member.h" |
#include "base/timer/timer.h" |
#include "chrome/browser/prefs/pref_service_syncable_observer.h" |
+#include "components/keyed_service/core/keyed_service.h" |
#include "ui/message_center/notifier_settings.h" |
namespace base { |
@@ -32,14 +33,16 @@ class PrefRegistrySyncable; |
class Notification; |
class Profile; |
-// ExtensionWelcomeNotification is a part of DesktopNotificationService and |
-// manages showing and hiding a welcome notification for built-in components |
-// that show notifications. The Welcome Notification presumes network |
-// connectivity since it relies on synced preferences to work. This is generally |
-// fine since the current consumers on the welcome notification also presume |
-// network connectivity. |
+// ExtensionWelcomeNotification is a keyed service which manages showing and |
+// hiding a welcome notification for built-in components which show |
robliao
2014/09/18 20:10:01
Nit: s/which/that
The first clause is non-restric
Peter Beverloo
2014/09/19 13:01:22
Insightful, thanks :-).
|
+// notifications. The Welcome Notification presumes network connectivity since |
+// it relies on synced preferences to work. This is generally fine since the |
+// current consumers on the welcome notification also presume network |
+// connectivity. |
+// |
// This class expects to be created and called from the UI thread. |
-class ExtensionWelcomeNotification : public PrefServiceSyncableObserver { |
+class ExtensionWelcomeNotification : public KeyedService, |
+ public PrefServiceSyncableObserver { |
public: |
// Allows for overriding global calls. |
class Delegate { |
@@ -58,20 +61,19 @@ class ExtensionWelcomeNotification : public PrefServiceSyncableObserver { |
// Requested time from showing the welcome notification to expiration. |
static const int kRequestedShowTimeDays; |
+ // The extension Id associated with the Google Now extension. |
+ static const char kChromeNowExtensionID[]; |
+ |
virtual ~ExtensionWelcomeNotification(); |
// To workaround the lack of delegating constructors prior to C++11, we use |
// static Create methods. |
- // Creates an ExtensionWelcomeNotification owned by the specified |
- // extension id with the default delegate. |
+ // Creates an ExtensionWelcomeNotification with the default delegate. |
static scoped_ptr<ExtensionWelcomeNotification> Create( |
- const std::string& extension_id, |
Profile* const profile); |
- // Creates an ExtensionWelcomeNotification owned by the specified |
- // extension id with the specified delegate. |
+ // Creates an ExtensionWelcomeNotification with the specified delegate. |
static scoped_ptr<ExtensionWelcomeNotification> Create( |
- const std::string& extension_id, |
Profile* const profile, |
Delegate* const delegate); |
@@ -89,7 +91,6 @@ class ExtensionWelcomeNotification : public PrefServiceSyncableObserver { |
enum PopUpRequest { POP_UP_HIDDEN = 0, POP_UP_SHOWN = 1, }; |
ExtensionWelcomeNotification( |
- const std::string& extension_id, |
Profile* const profile, |
ExtensionWelcomeNotification::Delegate* const delegate); |
@@ -162,4 +163,4 @@ class ExtensionWelcomeNotification : public PrefServiceSyncableObserver { |
DISALLOW_COPY_AND_ASSIGN(ExtensionWelcomeNotification); |
}; |
-#endif // CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |
+#endif // CHROME_BROWSER_NOTIFICATIONS_EXTENSIONS_EXTENSION_WELCOME_NOTIFICATION_H_ |