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

Side by Side Diff: chrome/browser/sync/glue/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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
6 #define CHROME_BROWSER_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/observer_list_threadsafe.h" 10 #include "base/observer_list_threadsafe.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 13
14 class Profile; 14 class Profile;
15 15
16 namespace sync_notifier { 16 namespace sync_notifier {
17 class SyncNotifierObserver;
18 } // namespace
17 19
18 class SyncNotifierObserver; 20 namespace browser_sync {
19 21
20 // A thread-safe bridge for chrome events that can trigger sync notifications. 22 // A thread-safe bridge for chrome events that can trigger sync notifications.
21 // Currently only listens to NOTIFICATION_SYNC_REFRESH, triggering each 23 // Currently only listens to NOTIFICATION_SYNC_REFRESH, triggering each
22 // observer's OnIncomingNotification method. Only the SESSIONS datatype is 24 // observer's OnIncomingNotification method. Only the SESSIONS datatype is
23 // currently expected to be able to trigger this notification. 25 // currently expected to be able to trigger this notification.
24 // Note: Notifications are expected to arrive on the UI thread, but observers 26 // Note: Notifications are expected to arrive on the UI thread, but observers
25 // may live on any thread. 27 // may live on any thread.
26 class ChromeSyncNotificationBridge : public content::NotificationObserver { 28 class ChromeSyncNotificationBridge : public content::NotificationObserver {
27 public: 29 public:
28 explicit ChromeSyncNotificationBridge(const Profile* profile); 30 explicit ChromeSyncNotificationBridge(const Profile* profile);
29 virtual ~ChromeSyncNotificationBridge(); 31 virtual ~ChromeSyncNotificationBridge();
30 32
31 // These can be called on any thread. 33 // These can be called on any thread.
32 virtual void AddObserver(SyncNotifierObserver* observer); 34 virtual void AddObserver(sync_notifier::SyncNotifierObserver* observer);
33 virtual void RemoveObserver(SyncNotifierObserver* observer); 35 virtual void RemoveObserver(sync_notifier::SyncNotifierObserver* observer);
34 36
35 // NotificationObserver implementation. Called on UI thread. 37 // NotificationObserver implementation. Called on UI thread.
36 virtual void Observe(int type, 38 virtual void Observe(int type,
37 const content::NotificationSource& source, 39 const content::NotificationSource& source,
38 const content::NotificationDetails& details) OVERRIDE; 40 const content::NotificationDetails& details) OVERRIDE;
39 41
40 private: 42 private:
41 content::NotificationRegistrar registrar_; 43 content::NotificationRegistrar registrar_;
42 44
43 // Because [Add/Remove]Observer can be called from any thread, we need a 45 // Because [Add/Remove]Observer can be called from any thread, we need a
44 // thread-safe observerlist. 46 // thread-safe observerlist.
45 scoped_refptr<ObserverListThreadSafe<SyncNotifierObserver> > observers_; 47 scoped_refptr<ObserverListThreadSafe<sync_notifier::SyncNotifierObserver> >
48 observers_;
46 }; 49 };
47 50
48 } // namespace sync_notifier 51 } // namespace browser_sync
49 52
50 #endif // CHROME_BROWSER_SYNC_NOTIFIER_CHROME_SYNC_NOTIFICATION_BRIDGE_H_ 53 #endif // CHROME_BROWSER_SYNC_GLUE_CHROME_SYNC_NOTIFICATION_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698