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

Side by Side Diff: chrome/browser/notifications/extension_welcome_notification.h

Issue 2459823002: [Sync] Rename syncable_prefs to sync_preferences. (Closed)
Patch Set: Created 4 years, 1 month 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "components/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/prefs/pref_member.h" 14 #include "components/prefs/pref_member.h"
15 #include "components/syncable_prefs/pref_service_syncable_observer.h" 15 #include "components/sync_preferences/pref_service_syncable_observer.h"
16 #include "ui/message_center/notifier_settings.h" 16 #include "ui/message_center/notifier_settings.h"
17 17
18 namespace base { 18 namespace base {
19 typedef Callback<void(void)> Closure; 19 typedef Callback<void(void)> Closure;
20 } 20 }
21 21
22 namespace message_center { 22 namespace message_center {
23 class MessageCenter; 23 class MessageCenter;
24 } 24 }
25 25
(...skipping 11 matching lines...) Expand all
37 // ExtensionWelcomeNotification is a keyed service which manages showing and 37 // ExtensionWelcomeNotification is a keyed service which manages showing and
38 // hiding a welcome notification for built-in components that show 38 // hiding a welcome notification for built-in components that show
39 // notifications. The Welcome Notification presumes network connectivity since 39 // notifications. The Welcome Notification presumes network connectivity since
40 // it relies on synced preferences to work. This is generally fine since the 40 // it relies on synced preferences to work. This is generally fine since the
41 // current consumers on the welcome notification also presume network 41 // current consumers on the welcome notification also presume network
42 // connectivity. 42 // connectivity.
43 // 43 //
44 // This class expects to be created and called from the UI thread. 44 // This class expects to be created and called from the UI thread.
45 class ExtensionWelcomeNotification 45 class ExtensionWelcomeNotification
46 : public KeyedService, 46 : public KeyedService,
47 public syncable_prefs::PrefServiceSyncableObserver { 47 public sync_preferences::PrefServiceSyncableObserver {
48 public: 48 public:
49 // Allows for overriding global calls. 49 // Allows for overriding global calls.
50 class Delegate { 50 class Delegate {
51 public: 51 public:
52 Delegate() {} 52 Delegate() {}
53 virtual ~Delegate() {} 53 virtual ~Delegate() {}
54 virtual message_center::MessageCenter* GetMessageCenter() = 0; 54 virtual message_center::MessageCenter* GetMessageCenter() = 0;
55 virtual base::Time GetCurrentTime() = 0; 55 virtual base::Time GetCurrentTime() = 0;
56 virtual void PostTask( 56 virtual void PostTask(
57 const tracked_objects::Location& from_here, 57 const tracked_objects::Location& from_here,
(...skipping 12 matching lines...) Expand all
70 70
71 // To workaround the lack of delegating constructors prior to C++11, we use 71 // To workaround the lack of delegating constructors prior to C++11, we use
72 // static Create methods. 72 // static Create methods.
73 // Creates an ExtensionWelcomeNotification with the default delegate. 73 // Creates an ExtensionWelcomeNotification with the default delegate.
74 static ExtensionWelcomeNotification* Create(Profile* const profile); 74 static ExtensionWelcomeNotification* Create(Profile* const profile);
75 75
76 // Creates an ExtensionWelcomeNotification with the specified delegate. 76 // Creates an ExtensionWelcomeNotification with the specified delegate.
77 static ExtensionWelcomeNotification* Create(Profile* const profile, 77 static ExtensionWelcomeNotification* Create(Profile* const profile,
78 Delegate* const delegate); 78 Delegate* const delegate);
79 79
80 // syncable_prefs::PrefServiceSyncableObserver 80 // sync_preferences::PrefServiceSyncableObserver
81 void OnIsSyncingChanged() override; 81 void OnIsSyncingChanged() override;
82 82
83 // Adds in the welcome notification if required for components built 83 // Adds in the welcome notification if required for components built
84 // into Chrome that show notifications like Chrome Now. 84 // into Chrome that show notifications like Chrome Now.
85 void ShowWelcomeNotificationIfNecessary(const Notification& notification); 85 void ShowWelcomeNotificationIfNecessary(const Notification& notification);
86 86
87 // Handles Preference Registration for the Welcome Notification. 87 // Handles Preference Registration for the Welcome Notification.
88 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); 88 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs);
89 89
90 private: 90 private:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 std::unique_ptr<base::OneShotTimer> expiration_timer_; 156 std::unique_ptr<base::OneShotTimer> expiration_timer_;
157 157
158 // Delegate for Chrome global calls like base::Time::GetTime() for 158 // Delegate for Chrome global calls like base::Time::GetTime() for
159 // testability. 159 // testability.
160 std::unique_ptr<Delegate> delegate_; 160 std::unique_ptr<Delegate> delegate_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(ExtensionWelcomeNotification); 162 DISALLOW_COPY_AND_ASSIGN(ExtensionWelcomeNotification);
163 }; 163 };
164 164
165 #endif // CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_ 165 #endif // CHROME_BROWSER_NOTIFICATIONS_EXTENSION_WELCOME_NOTIFICATION_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/chrome_network_delegate_unittest.cc ('k') | chrome/browser/notifications/extension_welcome_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698