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

Unified Diff: chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc

Issue 411463003: [Sync] Trigger refresh for synced notifications on context change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 6 years, 5 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
« no previous file with comments | « chrome/browser/notifications/sync_notifier/chrome_notifier_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc
index 613a17896ce3900167807967149138e5b755ed31..c85fa07830561974947023c5edc27c1cc08db21c 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_service.cc
@@ -8,8 +8,10 @@
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
+#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim.h"
#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/notification_service.h"
#include "extensions/browser/event_router.h"
namespace notifier {
@@ -19,6 +21,8 @@ ChromeNotifierService::ChromeNotifierService(Profile* profile)
weak_ptr_factory_(this) {
synced_notifications_shim_.reset(new SyncedNotificationsShim(
base::Bind(&ChromeNotifierService::FireSyncJSEvent,
+ weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&ChromeNotifierService::NotifyRefreshNeeded,
weak_ptr_factory_.GetWeakPtr())));
}
@@ -40,4 +44,12 @@ void ChromeNotifierService::FireSyncJSEvent(
extensions::EventRouter::Get(profile_)->BroadcastEvent(event.Pass());
}
+void ChromeNotifierService::NotifyRefreshNeeded() {
+ const syncer::ModelTypeSet types(syncer::SYNCED_NOTIFICATIONS);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_SYNC_REFRESH_LOCAL,
+ content::Source<Profile>(profile_),
+ content::Details<const syncer::ModelTypeSet>(&types));
+}
+
} // namespace notifier
« no previous file with comments | « chrome/browser/notifications/sync_notifier/chrome_notifier_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698