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

Side by Side Diff: chrome/browser/sync/notifier/chrome_sync_notification_bridge.h

Issue 9512005: [Sync] Move BridgedSyncNotifier and ChromeSyncNotificationBridge to glue/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/observer_list_threadsafe.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13
14 class Profile;
15
16 namespace sync_notifier {
17
18 class SyncNotifierObserver;
19
20 // A thread-safe bridge for chrome events that can trigger sync notifications.
21 // Currently only listens to NOTIFICATION_SYNC_REFRESH, triggering each
22 // observer's OnIncomingNotification method. Only the SESSIONS datatype is
23 // currently expected to be able to trigger this notification.
24 // Note: Notifications are expected to arrive on the UI thread, but observers
25 // may live on any thread.
26 class ChromeSyncNotificationBridge : public content::NotificationObserver {
27 public:
28 explicit ChromeSyncNotificationBridge(const Profile* profile);
29 virtual ~ChromeSyncNotificationBridge();
30
31 // These can be called on any thread.
32 virtual void AddObserver(SyncNotifierObserver* observer);
33 virtual void RemoveObserver(SyncNotifierObserver* observer);
34
35 // NotificationObserver implementation. Called on UI thread.
36 virtual void Observe(int type,
37 const content::NotificationSource& source,
38 const content::NotificationDetails& details) OVERRIDE;
39
40 private:
41 content::NotificationRegistrar registrar_;
42
43 // Because [Add/Remove]Observer can be called from any thread, we need a
44 // thread-safe observerlist.
45 scoped_refptr<ObserverListThreadSafe<SyncNotifierObserver> > observers_;
46 };
47
48 } // namespace sync_notifier
49
50 #endif // CHROME_BROWSER_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698